I have JSON (shown below), I'm trying to parse all JSON, and each object will be a new instance of the class declaring the variables below. What is the best way to do this? Should I use JSONReader or use JSONObject and JSONArray. I read some lessons and asked some general questions, but I did not see examples of how to parse data like this.
{ "id": 356, "hassubcategories": true, "subcategories": [ { "id": 3808, "CategoryName": "Current Products", "CategoryImage": null, "hassubcategories": true, "subcategories": [ { "id": 4106, "CategoryName": "Architectural", "CategoryImage": "2637", "hassubcategories": true, "subcategories": [ { "id": 391, "CategoryName": "Flooring", "CategoryImage": "2745", "hassubcategories": false } ] } ] }, { "id": 3809, "CategoryName": "Non-Current Products", "CategoryImage": null, "hassubcategories": true, "subcategories": [ { "id": 4107, "CategoryName": "Desk", "CategoryImage": "2638", "hassubcategories": true, "subcategories": [ { "id": 392, "CategoryName": "Wood", "CategoryImage": "2746", "hassubcategories": false } ] } ] } ] }
source share