Type 1120: Access of undefined property JSON
If you’re using as3corelib like I’ve been using for quite some time now, you will notice this error. To fix it you simply need to remove the following import (it may vary based on your project structure):
import com.adobe.serialization.json.JSON;
and then you’ll need to modify your code to replace:
JSON.decode(myString); and JSON.encode(myObject);
to:
JSON.parse(myString); and JSON.stringify(myObject);
You can find the full details of the new implementation of the native JSON support in AS3 on Adobe’s Reference Site
Thanks so much! I searched for hours for a solution to the “Access of undefined property JSON” error I was getting, and 2 minutes after finding this blog post the project I’m trying to compile built and everything worked. I greatly appreciate you putting this information out there!
Charles.
Just wanted to add another note of thanks. This post saved me a lot of time–much appreciated.
Thanks a Million!!
wow, thanks for sharing. i’ve always used xml and veered away from json because i couldn’t figure out what to do with it. thanks a ton!
Thanks! Saved me unknown time and frustration. Keep up the good work.
Thanks!
Thanks…
THANKS!
Thanks:>