I want to parse a JSON file using native Android org.json.
The JSON is complex, and does not have a pre-defined structure. It can contain several levels of nesting for a key and just one value for another key. I can define any number of key value pairs with any type of structure.
I need to convert this to a dictionary. I cannot use any third party libraries like Jackson or Gson (for reasons I don't wish to discuss here). I do understand that it can be done very easily using the public APIs provided by these libraries.
If I want to do this on my own (using org.json perhaps), what is the best way to do it? Do I need to read every value, check if it is a JSONArray/JSONObject or a value and then perform recursion? Or can I just read the map that is in the JSONObject class using reflection and use it?
Any help is appreciated. Thanks!