Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're creating our JSON responses to my salesforce callouts in house, so I'm guessing the issue has to do with how we're representing NULL in the JSON response. Here's a snippet of the response SF gets:


Note the NULL value for Country, which isn't a string because it isn't in quotes. That seemed to be the proper way to do it from what I've seen online, but attempting to map response using JSON.deserializeUntyped got me the 'unrecognized token' error. Replacing null with any string, including "null", fixes the error.

So is my issue with not correctly representing NULL in my JSON, or is this an issue with the salesforce deserialize method?

share|improve this question
up vote 9 down vote accepted

In JavaScript/JSON null is defined but NULL isn't. Try null. (Which is different from "null" or 'null' which are strings.)

I just checked and Apex's JSON.deserializeUntyped throws System.JSONException: Unrecognized token 'NULL' for NULL but works with null i.e. it is (not to surprisingly) consistent with JavaScript/JSON.

share|improve this answer
JSON, like JavaScript, is indeed case sensitive. – sfdcfox Jul 26 '14 at 0:11
That did it, thanks! – smohyee Jul 28 '14 at 17:24

Your Answer


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.