In my code it is making Ajax request for json data. For JSON output I am using drupal_json()
function.
But on browser side it is invoking error handler instead of success handler and getting 'parsererror'.
The JSON data is like this:
{
"affiliate_urls": {
"4131": {
"nid": "4131",
"title": "play.com - Books",
"file_path": "sites/default/files/playlogo.gif",
"url_value": "http://www.play.com/Search.html?searchstring=asd+asdasd\x26searchsource=0\x26searchtype=allproducts"
}
}
}
When put on http://jsonlint.com/ I am getting this error:
Parse error on line 7:
... "url_value": "http://www.play.com
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
What is wrong with passing URL value over JSON? and still using drupal_json()
.
Please help on it.
Thanks
\x26
. Now, if you are asking us about json, it's offtopic and should be asked on Stack Overflow. For example here. If you are asking us why Drupal generates bad json, show us the part of your Drupal code that generates it. – Mołot Sep 9 '13 at 6:54drupal_json()
function), it should be sent to it's issue queue - please flag it appropriately. If you think it's a problem with the way he is using it, please state it clearly. Now I'm not quite sure which case is it. – Mołot Sep 9 '13 at 7:28