# Help with JSON Decode Please look

**URL:** https://forum.kirupa.com/t/help-with-json-decode-please-look/318113
**Category:** Uncategorized
**Created:** [January 11, 2011, 1:40am UTC](https://forum.kirupa.com/t/help-with-json-decode-please-look/318113 "2011-01-11T01:40:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![as3ohh](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@as3ohh](https://forum.kirupa.com/u/as3ohh)
#### Post date: [January 11, 2011, 1:40am UTC](https://forum.kirupa.com/t/help-with-json-decode-please-look/318113/1 "2011-01-11T01:40:47Z")

</div>

Hey Friends, I have some code that I got from a working example tutorial. I thought this would work but am getting some errors I’m not familiar with. If any script gurus could take a quick look I would very much appreciate it. I’m new to JSON and rusty with AS. Many thanks.

The errors are:

TypeError: Error #1034: Type Coercion failed: cannot convert Object@2cf94c71 to Array.  
at testJson\_fla::MainTimeline/decodeJSON()  
at flash.events::EventDispatcher/dispatchEventFunction()  
at flash.events::EventDispatcher/dispatchEvent()  
at [flash.net](http://flash.net)::URLLoader/onComplete()

The code is:

```auto

```

//import Jason.as class  
import com.adobe.serialization.json.JSON;

var loader:URLLoader = new URLLoader();  
var request:URLRequest = new URLRequest();

//reading data from txt file

//Json can be called from any file like .txt .php etc. i Used here .txt  
request.url = “[http://api.brightcove.com/services/library?command=find\_video\_by\_id&video\_id=742822863001&video\_fields=name,length,shortDescription&token=Hq5dquUiLfWbyvqt-RCRt1TTbMgp4iTZRYXsfJxcwDo5aajWJTN7TQ](http://api.brightcove.com/services/library?command=find_video_by_id&video_id=742822863001&video_fields=name,length,shortDescription&token=Hq5dquUiLfWbyvqt-RCRt1TTbMgp4iTZRYXsfJxcwDo5aajWJTN7TQ)…&jsoncallback=?”;  
loader.load(request);

//On load i’m calling this event which call decoding json class file;  
loader.addEventListener(Event.COMPLETE, decodeJSON);

//decoding funtion;

function decodeJSON(event:Event):void  
{

```
var loader:URLLoader = URLLoader(event.target);
var MarqueeData:Array = JSON.decode(loader.data);

trace(MarqueeData[0].name);
trace(MarqueeData[0].length);
trace(MarqueeData[0].shortDescription);

marqData.text = MarqueeData[0].name + "&gt; " + MarqueeData[0].number + "&gt;&gt; " + MarqueeData[0].shortDescription;

```

}
