background preloader

JSON Jackson

Facebook Twitter

JSON. JacksonHome - FasterXML Wiki. Inspired by the quality and variety of XML tooling available for the Java platform (StAX, JAXB, etc.), the Jackson is a multi-purpose Java library for processing JSON data format.

JacksonHome - FasterXML Wiki

Jackson aims to be the best possible combination of fast, correct, lightweight, and ergonomic for developers. Introduction First things first: Jackson Tutorial gives you reasonable overview of basic usage Licensing page outlines what Open Source licenses are used with Jackson (ASL, LGPL) Jackson FAQ covers various other aspects, including common usage cases. Documentation hub -- place where most new documentation should be added, esp. links to external documentation, and presentations by Jackson development team and community. Testimonials After introduction, you may want to know who is already using Jackson for production work: Sampling of current users gives an idea of Jackson adoption Get it!

And then it may be time to check Jackson out: Project Bug reports and requests for new features are handled via: Other. How to convert Java Map to / from JSON (Jackson) In this tutorial, we will show you few Jackson examples to convert JSON string to/from a Map.

How to convert Java Map to / from JSON (Jackson)

How to convert Java object to / from JSON (Jackson) In this tutorial, we show you how to use Jackson 1.x data binding to convert Java object to / from JSON.

How to convert Java object to / from JSON (Jackson)

Note Jackson 1.x is a maintenance project, please use Jackson 2.x instead. 1. Quick Reference 1.1 Convert Java object to JSON, writeValue(...) ObjectMapper mapper = new ObjectMapper(); User user = new User(); mapper.writeValue(new File("c:\\user.json"), user); String jsonInString = mapper.writeValueAsString(user); 1.2 Convert JSON to Java object, readValue(...) P.S All examples are tested with Jackson 1.9.13 2. For Jackson 1.x, it contains 6 separate jars for different purpose, in most cases, you just need jackson-mapper-asl. pom.xml <dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>1.9.13</version></dependency> 3. An User object for testing. User.java package com.mkyong.json; import java.util.List; public class User { private String name; private int age; private List<String> messages; } Jackson API.