JSON.parse Error #1132: Invalid JSON parse input (Flex / Actionscript / PHP)

后端 未结 4 987
梦毁少年i
梦毁少年i 2021-01-14 15:40

I am getting \"Error #1132: Invalid JSON parse input\" and cannot understand why.

My json is generated by php: json_encode($x). Output json if displayed in TextArea(

4条回答
  •  没有蜡笔的小新
    2021-01-14 15:58

    There is no problem with JSON and I know that the question has already an answer, but this answer is for those people who still face the following error message:

    Syntax Error: Error #1132: Invalid JSON parse input.

    It can be a matter of misfitting result format when it comes to the HTTPService options: Try the text or e4x format (they are the most convenient ones) and avoid the xml format which may introduce some extra characters to the JSON output triggering some errors.

    Parse your data by using:

    var temp_obj:Object = JSON.parse(event.result as String);
    

    and trigger the JSON output by calling the HTTPService with the correct resultFormat:

    resultFormat="text"
    

    or

    resultFormat="e4x"
    

提交回复
热议问题