锘??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜精品久久17c,大香伊人久久,成年人在线播放http://www.aygfsteel.com/paulwong/category/55336.htmlzh-cnFri, 30 Oct 2020 05:17:18 GMTFri, 30 Oct 2020 05:17:18 GMT60Pretty print JSON using org.json library in Javahttp://www.aygfsteel.com/paulwong/archive/2020/10/28/435709.htmlpaulwongpaulwongWed, 28 Oct 2020 09:17:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/10/28/435709.htmlhttp://www.aygfsteel.com/paulwong/comments/435709.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/10/28/435709.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435709.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435709.htmlSyntax
public java.lang.String toString(int indentFactor) throws JSONException

Example

import org.json.*;
public class JSONPrettyPrintTest {
   
public static void main(String args[]) throws JSONException {
      String json 
= "{" +
                    
"Name : Jai," +
                    
"Age : 25, " +
                    
"Salary: 25000.00 " +
                    
"}";
      JSONObject jsonObj 
= new JSONObject(json);
      System.out.println(
"Pretty Print of JSON:");
      System.out.println(jsonObj.toString(
4)); // pretty print json
   }
}

Output

Pretty Print of JSON:
{
   "Salary": 25000,
   "Age": 25,
   "Name": "Jai"
}


paulwong 2020-10-28 17:17 鍙戣〃璇勮
]]>
5 ways to customize Spring MVC JSON/XML outputhttp://www.aygfsteel.com/paulwong/archive/2020/03/08/435236.htmlpaulwongpaulwongSun, 08 Mar 2020 07:55:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/03/08/435236.htmlhttp://www.aygfsteel.com/paulwong/comments/435236.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/03/08/435236.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435236.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435236.htmlhttps://mostafa-asg.github.io/post/customize-json-xml-spring-mvc-output/



paulwong 2020-03-08 15:55 鍙戣〃璇勮
]]>
浠ユ祦鐨勬柟寮忚В閲婂法澶SON鏂囦歡http://www.aygfsteel.com/paulwong/archive/2019/05/03/433743.htmlpaulwongpaulwongFri, 03 May 2019 07:22:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/05/03/433743.htmlhttp://www.aygfsteel.com/paulwong/comments/433743.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/05/03/433743.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/433743.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/433743.htmlhttps://www.ngdata.com/parsing-a-large-json-file-efficiently-and-easily/


https://sites.google.com/site/gson/streaming

http://www.acuriousanimal.com/2015/10/23/reading-json-file-in-stream-mode-with-gson.html

    public static void main(String [] args) throws IOException {
        String filePath = "C:big-data.json";
        FileInputStream in = new FileInputStream(new File(filePath));
        JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
        Gson gson = new GsonBuilder().create();
//        reader.beginObject();
//        reader.nextName();
        reader.beginObject();//璺寵繃"{"
        while (reader.hasNext()) {
            // Read data into object model
            JsonToken jsonToken = reader.peek();
            if(jsonToken.equals(JsonToken.NAME)) {
                String name = reader.nextName();
                if(name.equalsIgnoreCase("SUMMARY")) {
//                    reader.beginObject();
                    Summary summary = gson.fromJson(reader, Summary.class);
                    logger.info(summary.toString());
                    break;
//                    reader.endObject();//璺寵繃"}"
                }
            } /*else if(jsonToken.equals(JsonToken.BEGIN_OBJECT)) {
                reader.beginObject();
            } else if(jsonToken.equals(JsonToken.STRING)) {
                logger.info(reader.nextString());
            } else if(jsonToken.equals(JsonToken.NUMBER)) {
                logger.info(reader.nextInt() + "");
            } else if(jsonToken.equals(JsonToken.END_OBJECT)) {
                reader.endObject();
            } 
*/
//            Summary summary = gson.fromJson(reader, Summary.class);
//            break;
        }
        reader.close();
    }


paulwong 2019-05-03 15:22 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 增城市| 潜江市| 溆浦县| 岚皋县| 瑞丽市| 福安市| 宁晋县| 漾濞| 宜兰县| 泸州市| 搜索| 双牌县| 潼关县| 静海县| 鱼台县| 洞口县| 双江| 嘉善县| 建昌县| 绩溪县| 松江区| 磐石市| 双江| 柳江县| 团风县| 灌阳县| 武义县| 徐水县| 华蓥市| 东莞市| 东辽县| 弥勒县| 平原县| 塔城市| 成都市| 手游| 南城县| 晴隆县| 杂多县| 永吉县| 苏尼特左旗|