Package com.alibaba.fastjson

Examples of com.alibaba.fastjson.JSONReader.startArray()


    }
   
    public void test_array_1() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[{\"id\":123}]]"));
       
        reader.startArray();
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {}.getType());
       
        Assert.assertEquals(123, list.get(0).getId());
       
        reader.endArray();
View Full Code Here


       
        String text = strWriter.toString();
       
        StringReader strReader = new StringReader(text);
        JSONReader reader = new JSONReader(strReader);
        reader.startArray();
        ;
        while (reader.hasNext()) {
            SectionRequest vo = reader.readObject(SectionRequest.class);
            System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
                               + vo.getScreenWidth());
View Full Code Here

public class JSONReader_string extends TestCase {

    public void test_array() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[\"abc\"]"));

        reader.startArray();

        Assert.assertEquals("abc", reader.readString());

        reader.endArray();
View Full Code Here

    }
   
    public void test_array_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[\"abc\"]]"));

        reader.startArray();
        reader.startArray();

        Assert.assertEquals("abc", reader.readString());

        reader.endArray();
View Full Code Here

   
    public void test_array_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[\"abc\"]]"));

        reader.startArray();
        reader.startArray();

        Assert.assertEquals("abc", reader.readString());

        reader.endArray();
        reader.endArray();
View Full Code Here

    }
   
    public void test_array_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[[\"abc\"]]]"));

        reader.startArray();
        reader.startArray();
        reader.startArray();

        Assert.assertEquals("abc", reader.readString());
View Full Code Here

   
    public void test_array_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[[\"abc\"]]]"));

        reader.startArray();
        reader.startArray();
        reader.startArray();

        Assert.assertEquals("abc", reader.readString());

        reader.endArray();
View Full Code Here

    public void test_array_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[[\"abc\"]]]"));

        reader.startArray();
        reader.startArray();
        reader.startArray();

        Assert.assertEquals("abc", reader.readString());

        reader.endArray();
        reader.endArray();
View Full Code Here

        }

        JSONReader reader = new JSONReader(new StringReader(jsonStr.getBuffer().toString()));
        byte[] oneDates = null;
        byte[] twoDates = null;
        reader.startArray();
        while (reader.hasNext()) {
            if (oneDates == null) {
                oneDates = reader.readObject(byte[].class);
            } else if (twoDates == null) {
                twoDates = reader.readObject(byte[].class);
View Full Code Here

        writer.close();

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

        JSONReader reader = new JSONReader(new FileReader(file));
        reader.startArray();
        reader.readObject();
        reader.endArray();
        reader.close();

    }
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.