JSON (JavaScript Object Notation), is a simple and easy to read and write data exchange format. It’s popular and implemented in countless projects worldwide, for those don’t like XML, JSON is a very good alternative solution.
In this series of Java JSON tutorials, we focus on three popular third party Java libraries to process JSON data, which are Jackson, Google Gson and JSON.simple
Jackson
A High-performance JSON processor.
- Jackson data binding example – Object & JSON
Example to use ObjectMapper writeValue() and readValue() to convert Java object to / from JSON. - Jackson data binding example – Map & JSON
Example to convert Java Map to / from JSON - Jackson Tree Model example
Read JSON into Tree, like DOM for XML. - Jackson Streaming example
Example to use JsonGenerator() and JsonParser() to stream read and write JSON data. - Pretty print JSON output in Jackson
Pretty print JSON output via defaultPrettyPrintingWriter().
Google Gson
It was originally created for use inside Google, now it is used by many public projects.
- Gson data model example – Object & JSON
Example to use toJson() and fromJson() to convert Java Object to / from JSON. - Gson Streaming example
Example to use JsonWriter() and JsonReader () to stream read and write JSON data. - Pretty print JSON output in Gson
Pretty print JSON output via GsonBuilder.
JSON.simple
Simple Java library for JSON, to read and write JSON data.
- JSON.simple example – Read and write JSON
Example to show you how to read and write JSON data to / from file.
本文介绍如何使用三种流行的 Java 库(Jackson、Google Gson 和 JSON.simple)来处理 JSON 数据。这些库提供了简单易用的方法来读写 JSON 数据,包括对象映射、流式处理及美化输出等功能。

320

被折叠的 条评论
为什么被折叠?



