function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Json.Deserialize complains "No such column" when documentation reads it shouldn't

I have a single object deployed to two organizations.  One org supports multi-currency and the other doesn't.  When I serialize the object in the multi-currency org (source) and try deserializing it on the one that doesn't (destination) I get the error:


No such column 'CurrencyIsoCode' on sobject of type Feedback_Config__c


It is true, Feedback_Config__c in the destination org doesn't have the field, CurrencyIsoCode.  But according to the documentation it shouldn't need it.


"If the JSON content to parse contains attributes not present in the Apex type specified in the argument, such as a missing field or object, this method ignores these attributes and parses the rest of the JSON content. However, for Apex saved using API version 24.0 or earlier, this method throws a run-time exception for missing attributes."


As my class is compiled api 27.0, the last part shouldn't be true.


Does anyone know if there's a reason Json.Deserialize(string, Feedback_Config__c.class) would fail when it shouldn't?  Is it something special about SObjects?




It may not be a fix, but it's a work-around.


I convert the json into an untyped map, remove the key, serialize the map, then deserialize into the object I wanted in the first place.


map<string, object> aMap = (map<string, object>) Json.DeserializeUntyped(aString);
string newJson = Json.serialize(aMap);
model.setConfig((Feedback_Config__c) Json.DeSerialize(newJson, Feedback_Config__c.class));


I am seeing this as well. Either this is a bug, or the documentation is wrong.


Has anyone logged a case with support?