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