actionScript 解析json开源包,比官方的好
?? 前段时间参与了一个移动的孵化器项目,用flex来解析json,本来想用官方的as3corelib来解析json文件,不过我发现他生成的json没有格式化,生成的一堆字符串混在一起,看这不舒服,我想其他人用这个包的时候也会和我有同样的感觉,我的想法是正确的,确实有人重写了官方的json包(adobe开源的东东就是不怎么样),试了一下,解析后,果然很有条理。。。
/**?? * Decodes a JSON string into a native object.?? * ?? * @param s The JSON string representing the object?? * @param strict Flag indicating if the decoder should strictly adhere?? * ??to the JSON standard or not.? The default of <code>true</code>?? * ??throws errors if the format does not match the JSON syntax exactly.?? * ??Pass <code>false</code> to allow for non-properly-formatted JSON?? * ??strings to be decoded with more leniancy.?? * @return A native object as specified by s?? * @throw JSONParseError?? * @langversion ActionScript 3.0?? * @playerversion Flash 9.0?? * @tiptext?? */??public static function decode( s:String, strict:Boolean = true ):*??{????return new JSONDecoder( s, strict ).getValue();???}?官方的我就不贴上来了,有兴趣的童鞋可以自己去官网看。。。。