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
mkdjnsmkdjns 

JSON error when deserializing data

Hello all-

 

I'm getting the following when trying to deserialize a previously serialized object:

 

System.JSONException: Invalid format: "2011-12-26T00:00:00.000+0000" is malformed at "T00:00:00.000+0000" at [Source: java.io.StringReader@1c76581e; line: 1, column: 2860]: (System Code)

 

A simple way to reproduce this is to create a before update trigger on Account with the following: Make sure you have a date field in the account object and that the date field is populated.

 

string jsStr = json.serialize(trigger.newMap);
map<id, account> test = (map<id, Account>)json.deserialize(jsstr, map<id, Account>.class);
system.debug('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ deserialized map' +  test);	

 

The interesting bit is that the deserialization only fails if the account object is updated via the UI. If the update happens via APEX, everything works as expected. What's the cause of this?