Hi all,
I'm working with the Last.fm API at the moment and i'm having trouble with a block of text and JSON.
Basically, I call the API using a page similar to:
http://www.scgough.co.uk/include/lastfm/jsontest.php?artist=nirvana
this brings back the artist name, mbid, url, image url, summary and description.
as you can see if you 'view source', i want to return this as a json string to be processed in javascript. without the summary and descrption, all is ok but with it, i get an invalid JSON object back according to javascript.
I'm escaping the text with:
but i'm obviously missing something. Any ideas?!? 
I'm working with the Last.fm API at the moment and i'm having trouble with a block of text and JSON.
Basically, I call the API using a page similar to:
http://www.scgough.co.uk/include/lastfm/jsontest.php?artist=nirvana
this brings back the artist name, mbid, url, image url, summary and description.
as you can see if you 'view source', i want to return this as a json string to be processed in javascript. without the summary and descrption, all is ok but with it, i get an invalid JSON object back according to javascript.
I'm escaping the text with:
PHP:
$output.=",summary : ".chr(34).addslashes(htmlspecialchars($bio->summary)).chr(34);
$output.=",description : ".chr(34).addslashes(htmlspecialchars($bio->content)).chr(34);
