note 73675 rejected from function.json-decode by nlopess

From: Date: Tue, 01 May 2007 13:35:51 +0000
Subject: note 73675 rejected from function.json-decode by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126032@lists.php.net to get a copy of this message
Note Submitter: tandler at adaptik dot de ---- 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?

« previous php.notes (#126032) next »