You need to sign in to do that
Don't have an account?
Carter Mellor
FATAL_ERROR System.JSONException: Cannot deserialize instance of reference from START_OBJECT value { or request may be missing a required field
I'm passing a custom class wrapper from an apex controller to a Lightning component, then later send it back using JSON.Stringify(theWrapper). But the apex controller can't deserialize the wrapper, giving me the error above. I've narrowed it down to lookup fields somehow getting converted from a string of the id to a whole object while in the lightning component.
Basically, theObject.Lookup__c = '0000000000123'. From the apex controller, it can be read as {"theObject":{"Lookup__c":"0000000000123"}}.
But when passed back from the lightning component, it's read as {"theObject":{"Lookup__c":{"id":"0000000000123", "name":"Lookup record"}}}
I think it's unable to deserialize because it's no longer just a string.
For reference, I'm trying to deserialise like this:
How should I go about handling this?
Basically, theObject.Lookup__c = '0000000000123'. From the apex controller, it can be read as {"theObject":{"Lookup__c":"0000000000123"}}.
But when passed back from the lightning component, it's read as {"theObject":{"Lookup__c":{"id":"0000000000123", "name":"Lookup record"}}}
I think it's unable to deserialize because it's no longer just a string.
For reference, I'm trying to deserialise like this:
@AuraEnabled public static String upsertSelectedBooking (String sbwString){ system.debug('sbwString: ' + sbwString); selectedBookingWrapper sbw = (selectedBookingWrapper)System.JSON.deserialize(sbwString, selectedBookingWrapper.class); //The rest //... }
How should I go about handling this?
Veena Sundara-Heragu
Can you post the code for he wrapper class ?