# as3corelib - JSON - Unexpected Encountered

**URL:** https://forum.kirupa.com/t/as3corelib-json-unexpected-encountered/264781
**Category:** flash
**Created:** [June 30, 2008, 2:13pm UTC](https://forum.kirupa.com/t/as3corelib-json-unexpected-encountered/264781 "2008-06-30T14:13:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dewey](https://forum.kirupa.com/u/dewey)
#### Post date: [June 30, 2008, 2:13pm UTC](https://forum.kirupa.com/t/as3corelib-json-unexpected-encountered/264781/1 "2008-06-30T14:13:56Z")

</div>

Hey Everyone,

I’ve been scouring Google for an answer to my question and I can’t for the life of me figure it out…

I downloaded the as3corelib to do some JSON decoding, however, I always get this error

```auto
Error: Unexpected c encountered
    at com.adobe.serialization.json::JSONTokenizer/parseError()
    at com.adobe.serialization.json::JSONTokenizer/getNextToken()
    at com.adobe.serialization.json::JSONDecoder/nextToken()
    at com.adobe.serialization.json::JSONDecoder/parseObject()
    at com.adobe.serialization.json::JSONDecoder/parseValue()
    at com.adobe.serialization.json::JSONDecoder()
    at com.adobe.serialization.json::JSON$/decode()
    at mtvn.toonimator::Toonimator/_configLoaded()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

```

I am reading the data from a file called config.dat… which looks like this…

```auto
config={
    "actors": [
        "actor1",
        "actor2",
        "actor3"
    ],
 
    "decors": [
        "decor1",
        "decor2",
        "decor3"
    ], 

    "props": [
        "prop1",
        "prop2",
        "prop3"
    ],

    "music": [
        ["song1", "music1"],
        ["song2", "music2"],
        ["song3", "music3"]
    ],
    "intros": [
        "intro1",
        "intro2",
        "intro3",
    ]
}

```

I’ve tried changing the config= to nothing and I get “Unexpected encountered”. Reading a flickr feed ([http://www.flickr.com/services/feeds/photos\_public.gne?tags=flex&format=json](http://www.flickr.com/services/feeds/photos_public.gne?tags=flex&format=json) - as a test) and I get “Unexpected j encountered”

Can someone PLEASE help me out here?

Thanks,

–d

---

<div class="post-metadata">

### Author: ![Sage\_of\_Fire](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sage\_of\_Fire](https://forum.kirupa.com/u/Sage_of_Fire)
#### Post date: [July 1, 2008, 2:31am UTC](https://forum.kirupa.com/t/as3corelib-json-unexpected-encountered/264781/2 "2008-07-01T02:31:38Z")

</div>

Okay, this is just a shot in the dark for me, but I’ll try it anyway. Is it possible that you have to declare the config object with “var config” or “var config = function(){” before it’ll work? I assume you probably just left that out of the example, but I’ll try it anyway!

---

<div class="post-metadata">

### Author: ![wvxvw](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wvxvw](https://forum.kirupa.com/u/wvxvw)
#### Post date: [July 1, 2008, 3:20pm UTC](https://forum.kirupa.com/t/as3corelib-json-unexpected-encountered/264781/3 "2008-07-01T15:20:45Z")

</div>

```auto
config={
    "actors": [
....

```

Should this be AS code? To my best knowlage it never worked that way in AS…

```auto
var obj:Object = {prop:"value"};

```

I.e. properties’ name shouldn’t be wrapped with quotes.
