1

I have an array which has 3 JsonNodes. I managed to print the JsonNode that I want (which is an array)

Key: modelInformation
Value:[{"projectName":"Jum","modelName":"Jum01","modelId":"122"}}

Unfortunaly it looks like it merged the values together. How do I separate the key from the value in the Value section?

For example

Key: projectname
Value: Jum

field.getKey() or field.getValue() dosent work! Key is modelInformation and value is:

[{"projectName":"Jum","modelName":"Jum01","modelId":"122"}}
Aniket Sahrawat
  • 12,410
  • 3
  • 41
  • 67
Hye
  • 21
  • 1
  • 6

1 Answers1

0

You should treat the Value of you json object as a new JSONObject, which is already the case. Or more, the value in your case is an array of Json Objects.

So you can use:

JSONObject jsonObj = new JSONObject(field.getValue());

Or if you are not sure if it's an array or an object, please take a look on this link.

Incepter
  • 2,711
  • 15
  • 33