javascript - Why is my json unable to be converted to a string? -


i have function gets remote json json believe poorly formatted can't use json.stringify method on it. think it's due apostrophe contained in of it. have no access sever. there way can parse , change json remote json pulled formatted correctly?

this format now.

var jsonst = {"shows":[{"show_id":6387, "shownum":6387,"title":"the protestant's  dilemma","guest":"devin rose","category":"non-catholic","url":"http://www.catholic.com /radio/shows/the-protestants-dilemma-11565","audiourl":"http://www.catholic.com/sites /default/files/audio/radioshows/ca140331b.mp3","datetime":"1396317600","description":" devin rose grew militant's<\/p>","thumbnailsmall":"http://www.catholic.com/sites/default/files/imagecache/profile_square_small/images/profilepics/a109aad8daa70ad8976ffc.l._v387899120_sx200_.jpg","thumbnaillarge":"http://www.catholic.com/sites/default/files/imagecache/profile_square_large/images/profilepics/a109aad8daa70ad8976ffc.l._v387899120_sx200_.jpg"}]}  var = jsonstring = json.stringify(jsonst); alert(jsonstring); 

typo:

var = jsonstring 

replace with

var jsonstring 

also, i'm getting syntaxerror: unexpected token illegal in variable jsonst:

it seems there's newline character in variable at:

"description":" devin rose grew .... 

remove newline / linebreak before d in devlin, jsonstring variable filled fine:

"{"shows":[{"show_id":6387,"shownum":6387,"title":"the protestant's  dilemma","guest":"devin rose","category":"non-catholic","url":"http://www.catholic.com /radio/shows/the-protestants-dilemma-11565","audiourl":"http://www.catholic.com/sites /default/files/audio/radioshows/ca140331b.mp3","datetime":"1396317600","description":"devin rose grew militant's</p>","thumbnailsmall":"http://www.catholic.com/sites/default/files/imagecache/profile_square_small/images/profilepics/a109aad8daa70ad8976ffc.l._v387899120_sx200_.jpg","thumbnaillarge":"http://www.catholic.com/sites/default/files/imagecache/profile_square_large/images/profilepics/a109aad8daa70ad8976ffc.l._v387899120_sx200_.jpg"}]}" 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -