I have the above json document. How can I access Product1 and Product2 in it. it's like
{
  "abc": "abc",
  "xyz": "xyz",
  "proudct1": {
    "id": "id",
    "name": "name"
  },
  "proudct2": {
    "id": "id",
    "name": "name"
  }
}
I have the above json document. How can I access Product1 and Product2 in it. it's like
{
  "abc": "abc",
  "xyz": "xyz",
  "proudct1": {
    "id": "id",
    "name": "name"
  },
  "proudct2": {
    "id": "id",
    "name": "name"
  }
}
 
    
     
    
    if you have multiable products. Your json is not effective.Products must be json array like
{
  "product": "Product Data",
  "version": 1.1,
  "releaseDate": "2017-01-18T00:00:00.000Z",
  "demo": true,
  "products": [
    {
      "Id": "1",
      "isDisplayed": "Yes",
      "Title1": "Microsoft",
      "Title2": "India",
      "URL": "abc",
      "ImageName": "Microsoft Logo",
      "isImgDownloaded": "Yes",
      "ImageURL": "xyz"
    },
    {
      "Id": "2",
      "isDisplayed": "Yes",
      "Title1": "Google",
      "Title2": "India",
      "URL": "abc",
      "ImageName": "Google Logo",
      "isImgDownloaded": "Yes",
      "ImageURL": "xyz"
    }
  ]
}
And you can access jsonarray object like this
JSONArray result = jsonString.getJSONArray("products");
for (int i = 0; i < result.length(); i++){
    JSONObject jsonObjectItem = result.getJSONObject(i);
    .
    .
    .
}
 
    
    You can use JSONOBject, it comes bundled with SDK so no need to import any third party lib.
Assume the above string is response.
JSONObject responseObj=new JSONObject(response);
JSONObject product1=responseObj.getJSONObject("product1");
String id=product1.getString("Id");
// ... and similarly for other keys
