function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srikar Reddy Srikar KSrikar Reddy Srikar K 

Need hierarchial json and how to read that in Apex.

Hi ALl,
My Json is similar to below, need help to read the below in Apex:
{  
  "ideal": 
    {  
      "product":"4",
      "percent":"25",
      "dollarAmount":"11250"
    },  
  "idealFiltered":[  
    {  
      "Type":Child1
      "dollarAmount":"11250",
     "InBudget":[  
        {  
           "percent":"70",
          "dollarAmount":"7000"
        },
        {  
          "percent":"30",
          "dollarAmount":"3000"
        }
     ]
    },
    {  
      "Type":Child2
      "dollarAmount":"11250",
     "InBudget":[  
        {  
           "percent":"80",
          "dollarAmount":"8000"
        },
        {  
          "percent":"40",
          "dollarAmount":"4000"
        }
     ]
    }    
 ]  
}
Thank you, Srikar
Malika Pathak 9Malika Pathak 9

Hi Srikar Reddy Srikar K ,

please find the solution

This tool will parse the json for you and create a class

http://json2apex.herokuapp.com/

If you find this solution is helpful for you please mark the best answer