You need to sign in to do that
Don't have an account?
Abhish Chalke
how to fetch a particular record from JSON parse
i am getting parsed data from this
my response is
how should I fetch this
in wlc variable I am getting parsed data
wrapperlhscount wlc = hrwdLocationHealthStatusTileController.parse(res.getBody());
my response is
{ "transactionSequenceId": "w465t4564hfgdys547ue54", "code": "200", "subCode": "1000", "status": "Success", "message": "OK", "parentCompanyId": "SWC", "responseData": { "locationHealthStatusList": [ { "companyId": "SWC", "parentCompanyId": "SWC", "family": "Managed Router Services", "status": "Normal", "statusCount": 3994 }, { "companyId": "SWC", "parentCompanyId": "SWC", "family": "Managed Router Services", "status": "Backup Down", "statusCount": 39 } ] } }I wanted to fetch statusCount from the response
how should I fetch this
in wlc variable I am getting parsed data
The JSON Response needs to be deserialized and then assigned to a String variable.
In the context of Apex, you can define an Apex class and then deserialize the JSON string into the class. Then testData1 is just a property of the class; Or you can simply deserialize the JSON string into a map using the deserializeUntyped method:
Recommend reviewing the examples provided in below posts to get started:
https://salesforce.stackexchange.com/questions/327930/getting-a-value-form-json-and-store-in-a-variable
https://salesforce.stackexchange.com/questions/273922/how-can-i-save-fetched-json-to-a-custom-objects-custom-field-json-parameters-d
https://stackoverflow.com/questions/62261252/apex-salesforce-read-json-from-response-and-store-it-in-a-string-variable
If this information helps, please mark the answer as best. Thank you