The Jsonobject and Gson of the Android JSON parsing
Author: @gzdaijie
This article for the author original, reprint please specify the Source: http://www.cnblogs.com/gzdaijie/p/5189542.html directory 1. Written in the front
How to use 2.JSONObject
2.1 Sample Code
The 2.2 string jsondata is as follows, and the diagram shows the results
How to use 3.GSON
3.1 Download and install
3.2 Method Introduction
3.3 Sample Code
3.4 More methods
1. Written in front
JSON data is a common data format for Android network development, and JSON's most common method of transmission is to use the HTTP protocol, and the use of the HTTP protocol in Android development can be referenced in my other essay, the HTTP of Android network programming, There are several ways to parse JSON data: Use the official jsonobject to use a third-party open source library, including but not limited to Gson, Fastjson, and Jackson, this article mainly describes the use of the Gson library provided by Google. How to use 2.JSONObject 2.1 Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21-22 |
Org.json.JSONArray; Org.json.JSONObject; private void Parsejsonwithjsonobject (String jsondata) {try { |