note 73675 added to function.json-decode

From: Date: Tue, 06 Mar 2007 11:51:38 +0000
Subject: note 73675 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-124149@lists.php.net to get a copy of this message
I want to send/receive some programming-codes (HTML,CSS,Smarty-Variables etc.) with JSON, but i found something out: 1. You can't send a quotation mark ("), it will destroy the JSON object. But i replace it before with the html-code &quot; and it will works fine. strJSON = strJSON.replace(/"/g, "&quot;"); objJSON = json_encode(strJSON); 2. The next problem which i has found, was the line-breaks. It will also destroy the JSON object. I also replace it, and it will works fine. strJSON = strJSON.replace(/\n/g, ""); strJSON = strJSON.replace(/\r/g, ""); objJSON = json_encode(strJSON); 3. I had no problems with HTML-tags (like <p></p>). It would be send and receive correctly. But now i will find out, which other characters would be destroy the JSON object. Can anybody tell me which characters are not allowed in a JSON object? ---- Server IP: 212.124.37.9 Probable Submitter: 84.140.67.80 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/73675 Del: integrated -- https://master.php.net/note/delete/73675/integrated Del: useless -- https://master.php.net/note/delete/73675/useless Del: bad code -- https://master.php.net/note/delete/73675/bad+code Del: spam -- https://master.php.net/note/delete/73675/spam Del: non-english -- https://master.php.net/note/delete/73675/non-english Del: in docs -- https://master.php.net/note/delete/73675/in+docs Del: other reasons-- https://master.php.net/note/delete/73675 Reject -- https://master.php.net/note/reject/73675 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124149) next »