锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕精品视频,精品一区二区日本,激情久久五月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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 晴隆县| 稷山县| 盐池县| 许昌市| 鄂托克前旗| 黄梅县| 玉龙| 克什克腾旗| 永兴县| 通州市| 罗平县| 牟定县| 阿坝| 苏尼特右旗| 青龙| 通化市| 汝南县| 上栗县| 敖汉旗| 渭源县| 都安| 竹山县| 辛集市| 中卫市| 周宁县| 长子县| 盈江县| 靖安县| 赞皇县| 定远县| 同德县| 林西县| 大田县| 班戈县| 南木林县| 阿瓦提县| 五河县| 双桥区| 汉中市| 达孜县| 四川省|