Are there any stream-reading, parsing libraries available for json or xml formats in AS3? I'm setting up a long-polling application, using URLStream/URLRequest. I do not have control over the data I'm receiving other than a choice between formats. I'd like to have a parser that can handle fragments at a time, which would allow me to trigger custom events when certain complete fragments become available. Thoughts? What are current AIR applications doing to handle this?
Sample API:
var decoder:StreamingJSONDecoder = new StreamingJSONDecoder();
decoder.attachEvent("onobjectavailable", read_object);
while (urlStream.bytesAvailable)
{
decoder.readBytes(get_bytes(urlStream));
}
Yup.
Have a look at the AS3 Corelib: http://code.google.com/p/as3corelib/
It's an Adobe library. There should be more info on labs.adobe.com.
I did have an issues with the RSS parser on the date format, but other than that, everything seemed fine.
Goodluck!
The current AIR release (v2.5) bundles a newer WebKit that has native JSON support, via JSON.stringify() and JSON.parse().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With