在使用第三方api的使用,有时候会从网络中获得json数据,所以说我们将如何解析json数据?
下面小编将通过以下几点来进行json的讲解
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of theJavaScript Programming Language,Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
2.Json数据类型
2-1.json对象
2-2.json数组
ps:JSONObject与JSONArray的区别
(JSON数组)
(JSON数组)
3.解析JSON数据(小编使用的GSON进行json数据的解析)
3-1 【JSONObject的解析】
下面是一个json文件:
{
"resultcode": "200",
"reason": "successed!",
"result": {