请输入您要查询的百科知识:

 

词条 Jackson (API)
释义

  1. Implementation

  2. Usage example

  3. References

  4. External links

{{Infobox software
| name = Jackson
| logo =
| screenshot =
| caption =
| developer =
| latest release version = 2.9.8
| latest release date = {{release date and age|2018|12|15}}
| latest preview version =
| latest preview date =
| operating system = Cross-platform
| programming language =
| genre = API for JSON
| license = Apache License 2.0
}}

In computing, Jackson is a high-performance JSON processor for Java. Its developers extol the combination of fast, correct, lightweight, and ergonomic attributes of the library.[1][2]

Implementation

Jackson provides many ways of working including simple POJO converted to/from JSON for simple cases. Jackson provides a set of annotations for mapping too.[3][1]

Usage example

Sample code for reading and writing with POJOs may look like the following:[1]

public class ReadWriteJackson {

  public static void main(String[] args) throws IOException {    ObjectMapper mapper = new ObjectMapper();       String jsonInput = "{\\"id\\":0,\\"firstName\\":\\"Robin\\",\\"lastName\\":\\"Wilson\\"}";    Person q = mapper.readValue(jsonInput, Person.class);    System.out.println("Read and parsed Person from JSON: " + q);       Person p = new Person("Roger", "Rabbit");    System.out.print("Person object " + p + " as JSON = ");    mapper.writeValue(System.out, p);  }

}

References

1. ^{{Cite web|url= http://wiki.fasterxml.com/JacksonHome |title= History |date= |accessdate= 12 February 2016 |website= FasterXML |publisher= FasterXML |last= |first= |deadurl=yes |archiveurl=https://web.archive.org/web/20160211195332/http://wiki.fasterxml.com/JacksonHome |archivedate= 11 February 2016 |df= }}
2. ^{{Cite book |title = The Jackson Cookbook |last = Young |first = T.M. |publisher = Learnpub |year = 2013 |location = |volume = |pages = }}
3. ^{{Cite book|title = Java Cookbook|last = Darwin|first = I.F.|edition = 3rd|publisher = O'Reilly|year = 2014|location = Sebastopol, USA|volume = |pages = 656-657}}

External links

  • {{github|FasterXML/jackson}}

4 : Java platform|Java (programming language) libraries|JSON|Cross-platform free software

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/22 1:30:27