I have sent a request to a REST servlet and it returns a JSON array
- I need to get the JSON as a String for further processing.
Originally I used this to get the body:
DataNode result = body.get("carList");` return result.toString();`Then tried to parse the body, which is originally JSON, but ...
This string threw an exception from the
Jacksonlibrary:"Unexpected character ('c' (code 99)): was expecting double-quote to start field name at [Source: (String)"[{carNumber: 22248002, trailerNumber: }]"; line: 1, column: 4]"- These are the expected values.
- They are not in a recognised JSON form.
For the example above the requirement is:
[ {"carNumber" : "1234", "trailerNumber" : "567"}, ... ]- See: JSON.org
I have not (yet) found an example or guide rooting about in the documentation.
- I looked for things like
getJson(),getRaw()and such. I'm convinved it must be there. - In this case I want the entries from the list to use for testing an update operation.
- I looked for things like
Looking forward to your response.