tags: JSON entry json
JSONOBJECT, JSONARRAY
Dependence`
```java
```java
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.66</version>
</dependency>
JsonObject is simple to use
```java
```java
```java
package com.jyzw.fastJson;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class MyFastJson {
public static void main(String[] args) {
// Build a JSONOBJEC object
JSONObject jsonObject=new JSONObject();
/ / PUT value in jsonobject
jsonObject.put("id",123);
jsonObject.put("name",234);
// {"ID": 123, "name": 234} Here PUT is int type value
System.out.println(jsonObject.toJSONString());
JSONArray jsonArray=new JSONArray();
// Add JSONOBJECT to JSonarray
jsonArray.add(jsonObject);
// Output: [{"ID": 123, "Name": 234}]
System.out.println(jsonArray);
}
result
``{“name”:234,“id”:123} [{“name”:234,“id”:123}]
Student class Test case Console: output...
Example 1: JSON file program: Example two: program: JSON file Example three program: ...
[Image upload failed... (image-6adce8-1522634020763)] What is JSON? JSON (JavaScript Object Notation) is a lightweight data exchange format. Easy for people to read and write. It is also easy to machi...
One: traverse JsonArray Two: traversing JsonObject...
Reference URL: ...
Json-lib is used to complete the transformation of beans, collections, maps, java arrays, XML and JSON between jars, json-lib depends on several other jar packages (I tried all jars with the latest v...
First introduced jar package: JSONObject Usage: you may receive data format: { "id": "123", "courseID": "huangt-test", "title": "Submit Job"...
Recently, the company developed several projects in the background Action are Json format to the front-end data transfer, so to JSONObject, JSONArray simply study a little, ado, want to use JSONObject...