bijilsandroid / as3corelib

Automatically exported from code.google.com/p/as3corelib
0 stars 0 forks source link

[Question] Decodes a JSON string into a XML object. #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
My System:

Flex Builder 2.0.1
as3corelib version: Release version .90

Code: Decodes a JSON string into a Array object.
package
{

    import flash.display.Sprite;
    import com.adobe.serialization.json.JSON;
    import flash.xml.XMLDocument;
    public class JSonTest extends Sprite
    {
        public function JSonTest(){
          var object:Object=JSON.decode
('[{"title":"MTEnclosures","url":"http:www.ev123.com"}]');
          var xm:Array=(object as Array);
          trace("xm="+xm[0].title);
        }
    }
}
Code: Decodes a JSON string into a XML object.
package
{

    import flash.display.Sprite;
    import com.adobe.serialization.json.JSON;
    import flash.xml.XMLDocument;
    public class JSonTest extends Sprite
    {
        public function JSonTest(){
          var object:Object=JSON.decode
('[{"title":"MTEnclosures","url":"http:www.ev123.com"}]');
          var xm:XML=(object as XML);
          trace("xm="+xm);
        }
    }
}

Result: xm=null

Original issue reported on code.google.com by liangzho...@gmail.com on 30 Jan 2008 at 10:16

GoogleCodeExporter commented 8 years ago
Thanks for help me!

Original comment by liangzho...@gmail.com on 30 Jan 2008 at 10:17

GoogleCodeExporter commented 8 years ago

Original comment by mikechambers on 2 Jul 2008 at 4:46