Does anyone have problems with the ColdFusion serializeJSON method with PHP json_decode?

Interwebs do not help with this. We encode data in ColdFusion with serializeJSONand try to decode it in PHP with json_decode. In most cases, this works fine, but in some cases json_decodereturns NULL. We were looking for obvious criminals, but serializeJSONit seems to format things as expected. What else could be the problem?

UPDATE: several people (wisely) asked me to post a result that is causing the problem. I would like, moreover, that we just found that the result set is all our data (listing information for 2300+ rental properties for a total of 565,135 ASCII characters)! This can be a problem, although I have not seen anything in the PHP docs about the maximum size for a string. What will be the limiting factor? RAM?

UPDATE II. It seems that the problem was that several of our users copied and pasted Microsoft Word text with smart quotes. These annoying users ...

+5
source share
4 answers

UTF-8, PHP .

PHP json_decode, JSON UTF-8 ( "" , , ). PHP, UTF-8, Content-Type HTML-, PHP. , , JSON, UTF-8:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

PHP json_decode .

+2

? , , null? , , , , RFC 4627 JSON, , javascript, JSON. JSON javascript.

:

, PHP script ( , json_decode), ( ). - . , , , , ? ?

+1

, , ColdFusion JSON ( ), JSON.

, PHP, ColdFusion, , .

PHP-

, json_decode()

$string = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $string);

ColdFusion

cleanXmlString() SO serializeJSON()

+1

- , Python JSON . Python, demjson . , jsonlib - , demjson, C.

0

All Articles