0

" {"error":"ApplicationException","reason":"Data types of key columns do not match. 'USERS.lastmodifiedtime' is of 'TIMESTAMP', 'state_list.name' is of 'VARCHAR'."} "

Is stored in string format, I need it in json format

2
  • 2
    JSON is a string format, so it's already JSON. Commented Feb 28, 2013 at 6:57
  • In regards to the various answers here -- if you're trying to decide whether to use JSON.parse or jQuery.parseJSON, you should be aware that the jQuery version is better for cross-browser compatibility. See the following post stackoverflow.com/questions/10362277/… Commented Feb 28, 2013 at 7:02

5 Answers 5

4

Modern browsers have built in parser JSON.parse(string).

If you have to support older browsers you can add json2/json3 libraries. These will add the JSON.parse support if native support is not present in the browser.

If the string is not valid then a parse error will be thrown, in your case it looks like you may have to escape the 's.

Sign up to request clarification or add additional context in comments.

Comments

2

Use

jQuery.parseJSON( json )

example

var obj = jQuery.parseJSON('{"error":"ApplicationException"}');

for more info see details

Comments

2

To convert the JSON-string1 to Object, parse it. You should mind escaping apostrophes here:

JSON.parse('{"error":"ApplicationException","reason":"Data types of key columns do not match. \'USERS.lastmodifiedtime\' is of \'TIMESTAMP\', \'state_list.name\' is of \'VARCHAR\'."}')

1 JSON: JavaScript Object Notation

Comments

0

You could use something like this

var obj = jQuery.parseJSON('{"error":"ApplicationException"}');

Comments

0

You can use (jQuery)

$.parseJSON(STRING);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.