In general I know how to create a apex class to parse the JSON response in salesforce. But with the current system I am integrating has a weird node name format and i having issues with creating apex class.
Below is the sample HAL+JSON
{
"TotalResults": 30,
"TotalPages": 2,
"e:Page": 1,
"_links": "www.google.com",
"e:itemlink":[
{"href":"link1"},
{"href":"link2"},
{"href":"link3"}
]
}
For the above JSON i usually create a apex class like this
public class linkJson{
public Integer TotalResults;
public Integer TotalPages;
public Integer e:Page; //this throws error because of naming convention
public String _links;
public cls_e:itemlink[] e:itemlink; //this throws error because of naming convention
//this through error because of naming
class cls_e:itemlink {
public String href;
}
public static linkJson parse(String json){
return (linkJson) System.JSON.deserialize(json, linkJson.class);
}
}
I appreciate any help in resolving this issue.