Java JSON Tutorial
2013-10-31 00:23
507 查看
Java JSON Tutorial
Posted on August 12, 2011 , Last modified : August 23, 2011
By
mkyong
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 manypublic 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.
References
Introducing JSONJSON described in RFC 4627
JSON Wiki
Jackson official website
Gson official website
JSON.simple official website
Review of 5 Java JSON libraries
Jackson vs Gson
相关文章推荐
- Java JSON Conversion Tutorial
- java json代码自动生成
- Java构造和解析Json数据的两种方法详解一:使用org.json库
- java 创建JSONArray和JSONObject
- java 组装json格式的数据
- Java中的List转换成JSON报错(一)
- JSON字符串和java对象的互转【json-lib】
- Rhythmk 一步一步学 JAVA(3): java JSON 数据序列化 以及反序列化
- 用Java对JSON字符串进行格式化输出
- java对象转json的死循环解决
- Java 的JSON、XML转换方法——目录索引
- java JSONObject/JSONArray详解
- Java1.5泛型指南中文版(Java1.5 Generic Tutorial)
- AJAX框架JSON-RPC-Java 1.0rc2 发布
- java对象与JSON对象的互换
- jackson进行json与java对象转换
- java 中使用 JSON
- JAVA解析JSON
- JAVA解析JSON的例子
- Java必备:JSON解析工具-json-lib