Home:
http://jackson.codehaus.org/
Https://github.com/FasterXML/jackson
Currently Jackson is divided into three parts that need to be downloaded separately;
Jackson-annotations-2.5.0.jar,jackson-core-2.5.0.jar,jackson-databind-2.5.0.jar
Java Bean:
PackageCom.srie.test.json;Importjava.io.IOException;ImportCom.fasterxml.jackson.databind.ObjectMapper; Public classTestjson { Public Static voidMain (string[] args)throwsIOException {User user1=NewUser (1, "a"); User User2=NewUser (2, "B"); Objectmapper Mapper=NewObjectmapper (); //Mapper.writevalue (System.out, user1);System.out.println (Mapper.writerwithdefaultprettyprinter (). writevalueasstring (user1)); String String=mapper.writevalueasstring (User2); System.out.println (string); }}classUser {Private intID; PrivateString name; @Override PublicString toString () {return"User [id=" + ID + ", name=" + name + "]"; } PublicUser () {} PublicUser (intID, String name) { Super(); This. ID =ID; This. Name =name; } Public intgetId () {returnID; } Public voidSetId (intID) { This. ID =ID; } PublicString GetName () {returnname; } Public voidsetName (String name) { This. Name =name; }}
Jackson-Build Jason Tool-simple example