json使用

package helloworld;

import com.XX.fastjson.JSONArray;
import com.XX.fastjson.JSONObject;

public class test {

    public static void main(String[] args) {
        JSONArray array = new JSONArray();
        
        
        int i;
        for(i = 1; i <= 3; i++){
            JSONObject json = new JSONObject();
            json.put("type", "paragraph"+String.valueOf(i));
            array.add(json);
        }
        
        String jsonStr = array.toString();

        System.out.println(jsonStr);

    }

}
原文地址:https://www.cnblogs.com/huhuuu/p/4326313.html