JSON support in your Flex application

Posted on June 12, 2010

I don’t know why JSON is not natively supported in Flex, since it’s a widely used serialization format (even the latest version, Flex 4 when I write these lines). Whatever, if you want JSON serialization functions in your Flex application, you will need to add a library to your project by yourself.

However, Adobe itself made a JSON library that you can find at http://code.google.com/p/as3corelib/. Follow these steps to add your JSON library to your Flex project:

  1. Download the .zip archive and extract it. What you need is the .swc file in the lib folder.
  2. In Flex Builder / Flash Builder, go to your project’s properties, and then to the Flex Build Path panel.
  3. Click on Add SWC, and select the as3corelib.swc file
  4. In your project, add the following line: import com.adobe.serialization.json.JSON;

You should be able now to use JSON functionalities in your Flex project 🙂