1
我有以下两个例程在Flash Builder:的as3corelib JSON解析问题
public function getData():void {
httpService = new HTTPService();
httpService.url = "https://mongolab.com/api/1/databases/xxx/collections/system.users/?apiKey=xxx";
httpService.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
httpService.addEventListener(ResultEvent.RESULT, resultHandler);
httpService.send();
}
public function resultHandler(event:ResultEvent):void {
var rawData:String = String(event.result);
var arr:Array = JSON.decode(rawData) as Array;
Debug.log(rawData);
Debug.log(arr);
httpService.removeEventListener(ResultEvent.RESULT, resultHandler);
}
RAWDATA显示为JSON数据但ARR显示为[对象对象],而不是阵列。
我在做什么错?
感谢队友。抱歉,延迟的回应。 –
如果这是您的正确答案,请将其标记为。谢谢 – pkyeck