Jackson Datatype Module: "json-org"

This module adds support for reading and writing datatypes of json.org JSON library. Support is mostly planned to allow easy migration from json.org package to Jackson, by allowing Jackson to be used for low-level parsing and JSON generation, while still allowing existing use of json.org types such as org.json.JSONObject and org.json.JSONArray.

Project home page is at GitHub, jackson-datatype-json-org.

Usage

Register module with ObjectMapper:

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new JsonOrgModule());

And then you can read and write JSON to/from org.json.JSONObject:

    JSONObject ob = mapper.readValue(json, JSONObject.class); // read from a source
    String json = mapper.writeValue(ob); // output as String


Back to JacksonModuleProjects.


CategoryJackson

JacksonModuleJsonOrg (last edited 2011-11-06 04:02:38 by TatuSaloranta)

Copyright ©2009 FasterXML, LLC