You need to sign in to do that
Don't have an account?
Sanchivan Sivadasan
Exception: System.JSONException: Illegal value for primitive
Hi there,
I am getting the following ERROR:
Exception: System.JSONException: Illegal value for primitive
When I try to deserialize the HTTP response from Jive to an object.
JivePersonObject personRecord = (JivePersonObject) System.JSON.deserialize(jiveResponse, JivePersonObject.class);
I have validated the JSON string at http://jsonlint.com/ and it is valid.
This is not happening for all the response. It is happening for some response and some of them don't have the issue.
I was wondering if anyone have come across this issue before. Not sure what I am doing wrong here. Thanks.
Sanch
You could also use the following app and compare how the output looks to your JivePersonObject class: http://json2apex.herokuapp.com
I found when I tried to use a custom SObject, the parser didn't like that all my JSON parameters didn't end in '__C'.
I used the following methods to make my class play nice with the Parser, and my other code.
Turned out I was passing more detail than I needed to in my json object.
My class was expecting a simple list of Ids: but I was sending a compound object:
I simplified the construction to just include the Id and it worked fine.
I could have added a wrapper class with those items, but didn't need to in my case.