A fully featured but lightweight JSON decoder component. Decodes a JSON string into an object using the following features:
Script Tag Evaluation Plugin is included in this package with the open source Hurlant Evaluation Library
Examples are included
var decoder:JSONDecoder=new JSONDecoder();
decoder.addEventListener(Event.COMPLETE, OnDecoded);
JSONDecoder.DefaultAsyncIterationsPerMs=1500;//default iterations for 1ms - use with maxAsyncProcessTime
decoder.maxAsyncProcessTime=30;//default time in ms to process 1 async decoding frame, very useful when working with really large json objects in order to prevent application halting!
decoder.maxAsyncTime=2000;//default time in ms to prevent application halting - reduces iterations when reached
decoder.asyncTime=0;//default time to wait before the next async decoding
decoder.autoReprocessBelowPercent=.7;//default autoreprocess time - when 1 async decoding frame is finished there's a chance to process another one, if the desired iterations per frame are processed for less time
decoder.exportComments=true;//default is false - marks the option to export the string content of the inline/block comments
//Use decoder.exportedComments to access them
decoder.DecodeString(jsonString, null, true);
function OnDecoded(event:Event) : void
{
var decodedData:Object=decoder.output[0];//Note that every json structure is considered an array. In most cases you'll get the zero indexed object
}
Questions & Comments