1

I'm using Spring Data Rest for reading the records from amazon dynamodb. The service works fine except for output format.

The output I see from the service is -

---> HTTP GET 
---> END HTTP (no body)
<--- HTTP 200  (1082ms)
: HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/hal+json
X-Application-Context: application
Server: Jetty(8.1.14.v20131031)    

{"_links":{"search":{"href":"something"}},"_embedded":{"userInfoes":[{"id":"bde0ef42-30c2-4ccd-8b0f-44d718827f69","username":"dsds","password":"1234","highestscore":99,"_links":{"self":{"href":"something"}}}]}}

<--- END HTTP (291-byte body)    

But I need it in the below format[where no extra "_embedded" and "_links" tags are present] to retrieve the values easily. I'm using retrofit in the service layer. Please help!

[{"id":"bde0ef42-30c2-4ccd-8b0f-44d718827f69","username":"dsds","password":"1234","highestscore":99,}]
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • You should be able to use the Jackson library to marshall the data into an object, then pull out what you need: http://tutorials.jenkov.com/java-json/jackson-objectmapper.html – Jim Archer Dec 29 '15 at 21:35

0 Answers0