Package com.alibaba.fastjson

Examples of com.alibaba.fastjson.JSONWriter.endArray()


        JSONWriter writer = new JSONWriter(out);
        writer.startArray();
        writer.writeObject("1");
        writer.writeObject("2");
        writer.writeObject("3");
        writer.endArray();
        writer.close();

        Assert.assertEquals("[\"1\",\"2\",\"3\"]", out.toString());
    }
}
View Full Code Here


        req.setScreenWidth(12);// 父类中的属性
        req.setTag("11");
        JSONWriter writer = new JSONWriter(strWriter);
        writer.startArray();
        writer.writeObject(req);
        writer.endArray();
        writer.close();
       
        String text = strWriter.toString();
       
        StringReader strReader = new StringReader(text);
View Full Code Here

        StringWriter jsonStr = new StringWriter();
        JSONWriter writer = new JSONWriter(jsonStr);//超大文本写入
        writer.startArray();
        writer.writeValue(one);
        writer.writeValue(two);
        writer.endArray();
        try {
            writer.close();
        } catch (IOException e) {
        }
View Full Code Here

        }
        File file = File.createTempFile("fastjson-stream-large", "json");
        JSONWriter writer = new JSONWriter(new FileWriter(file));
        writer.startArray();
        writer.writeObject(list);
        writer.endArray();
        writer.close();

        System.out.println(FileUtils.readFileToString(file));

        JSONReader reader = new JSONReader(new FileReader(file));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.