Library for reading and writing JSON in Codename One
Failed to load latest commit information.
build Initial commit Nov 20, 2013
dist Fixed binary compatibility for libraries built against this prior to … Jul 21, 2016
lib Initial commit Nov 20, 2013
nbproject Initial commit Nov 20, 2013
src/ca/weblite/codename1/json Fixed binary compatibility for libraries built against this prior to … Jul 21, 2016
Stubber.jar Initial commit Nov 20, 2013
build.xml Fixed JSONObject and JSONArray toString to work recursively for maps … Nov 6, 2015 Initial commit Nov 20, 2013 Initial commit Nov 20, 2013

Codename One JSON Library

A library to read and write JSON in Codename One


This library is a port of this J2ME JSON library so that it can be used in Codename One. Only minor changes have been made in order to improve performance.

Codename One already includes a JSON parser, so why package up another library? One reason is for pure variety. The interface of this library is different than the built-in CN1 parser and this might be preferrable to some. Another reason is that it is easy to use this library outside of Codename One. If I'm writing code that I want to reuse in CN1 and other Java environments, I might choose to use this library for portability.


Apache License 2.0


  1. Codename One 1.0 or higher


  1. Download the CN1JSON.cn1lib file and copy it into your Codename One Application's "lib" directory.
  2. Right click on your application's icon in the Netbeans project explorer, and select "Refresh Libs"

Usage Examples

        JSONObject index = new JSONObject(myJSONString);

        JSONArray dests = index.getJSONArray("destinations");
        Map<String,SoundFile> audioFileIndex = new HashMap<String,SoundFile>();
        for ( int i=0; i<dests.length(); i++){
            JSONObject dest = dests.getJSONObject(i);
            PointOfInterest poi = new PointOfInterest();

            SoundFile sf = new SoundFile();
            audioFileIndex.put(dest.getString("audio_file"), sf);


You can find other usage examples on the J2ME-JSON site.

### Credits

  1. Library ported packaged by Steve Hannah
  2. Original JTar Library by Greyson