Deserialization of Time field throws JSON Exception
Last updated 2019-09-26 ·Reference W-4930701 ·Reported By 59 users
Deserialization of Time field is failing with the error:
ERROR MESSAGE : System.JSONException: Cannot deserialize instance of time from VALUE_STRING value 10:23:00.000Z or request may be missing a required field
1. Add "Time (BETA)" custom field such as "Time1" on Account object
2. Create an Account record with Time custom field
3. Run the below snipet via Developer Console (* 001xx000003DGQl is the Id of the created Account record)
Account acct = [SELECT Time1__c FROM Account WHERE Id='001xx000003DGQl'];
String jstr = JSON.serialize(acct);
SObject jsonResult = (Account)JSON.deserialize(jstr, type.forName('Account'));
System.debug('zzz ' + jsonResult);
4. You should see the error occurs
System.JSONException: Cannot deserialize instance of time from VALUE_STRING value xx:xx:xx.Z or request may be missing a required field
Reported By (59)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.