Gson json parser: keyless value

I want to analyze the json structure as follows:

{"response": { "arr1":[count,{...}], "arr2":[count,{...}] } } 

Everything is fine if the counter has an account key (for example). But the key is empty. How can I match this structure and manually output only this value, or do I need to parse all these json without gson?

UPDATED

Here is a valid json (marked with http://jsonlint.com/ )

 { "response": { "arr1": [ 615, { "body": "hi", "title": "Re(2): ..." }, { "body": "hello", "title": "Re(23): ..." } ], "arr2": [ 132, { "body": "hi", "title": "Re(2): ..." }, { "body": "hello", "title": "Re(23): ..." } ] } } 
+4
source share
1 answer

If you want to parse arbitrary collections, you should read Serializing and Deserializing Collections with Objects of Arbitrary Types and see Code Example for code .

+2
source

Source: https://habr.com/ru/post/1414891/


All Articles