You need to sign in to do that
Don't have an account?
code developer
JSON Response map with Apex Classes
Hi,
I am getting Json response from an api callout as shown below:
{"hint":"value"}.
In order to deserialize the json to my apex class, I have to declare a String variable hint,but hint is a reserved keyword.So, how should I map this json to my apex? please help me out.
I don't have a direct answer for this, but would it be possible to deserialize to a map instead?
From here, you can use:
To get the value of hint (e.g. "value"). Or, use a JSONParser instead, but this might be more tedious...
Edit: OR...
You can also use deserializeUntyped to get a Map< String, Object >, which you can use to get at "hint" directly. See the documentation for details.