SyntaxError: Unexpected token o in JSON at position 1

The JSON you posted looks fine, however in your code, it is most likely not a JSON string anymore, but already a JavaScript object. This means, no more parsing is necessary. You can test this yourself, e.g. in Chrome’s console: JSON.parse() converts the input into a string. The toString() method of JavaScript objects by default returns [object Object], resulting … Read more

Displaying better error message than “No JSON object could be decoded”

I’ve found that the simplejson module gives more descriptive errors in many cases where the built-in json module is vague. For instance, for the case of having a comma after the last item in a list: which is not very descriptive. The same operation with simplejson: Much better! Likewise for other common errors like capitalizing True.

Deserialize JSON with C#

You need to create a structure like this: Then you should be able to do: The names of my classes are just an example. You should use proper names. Adding a sample test: Produces:

How to send a Map in JSON

Key always should be string. Why it still doesn’t work? Because the error is caused by the redundant brace inside of “elementsToUpdate”. Below is an example:

jQuery AJAX cross domain

Use JSONP. jQuery: PHP: The echo might be wrong, it’s been a while since I’ve used php. In any case you need to output callbackName(‘jsonString’) notice the quotes. jQuery will pass it’s own callback name, so you need to get that from the GET params. And as Stefan Kendall posted, $.getJSON() is a shorthand method, but then you need to … Read more