I have a REST webservice which inserts multiple records into custom objects. I am executing it on workbench using the following request:

{"req" : {"tickets": [{ "External_TicketID__c" :1853, "Date_Time__c": "9/13/2015 20:30" }, { "External_TicketID__c" :26554, "Date_Time__c": "9/13/2015 22:30" } ]}}

I am getting the following JSON Parse error.What am I doing wrong?

message: Cannot deserialize instance of datetime from VALUE_STRING value 9/13/2015 02:30 AM at [line:3, column:37] errorCode: JSON_PARSER_ERROR

share|improve this question
    
Did you try passing in this format 2007-04-05T12:30-02:00 ? – karthikselva Feb 11 '16 at 18:06
up vote 1 down vote accepted

Assuming the field is a date-time field, you've the wrong format. It should be in standard ISO 8601 format:

{"req" : {"tickets": [{ "External_TicketID__c" :1853, "Date_Time__c": "2015-09-13T20:30:00.000Z" }, { "External_TicketID__c" :26554, "Date_Time__c": "2015-09-13T22:30:00.000Z" } ]}}

As a side note, make sure that External_TicketID__c is indeed a number field, or you'll get an error there, too.

share|improve this answer
    
I just tried deserializing a JSON string with the exact same format you have above. I received the following error: System.JSONException: Cannot deserialize instance of date from VALUE_STRING value 2016-12-05T16:19:44.000Z..... Check out the DateTime format: 2016-12-05T16:19:44.000Z - what's off? – ZAR Mar 30 '16 at 17:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.