Package com.alibaba.fastjson

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


   
    Assert.assertEquals("count", reader.readString());
    Assert.assertEquals(5, reader.readObject());
   
    Assert.assertEquals("pagecount", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    Assert.assertEquals("pageindex", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    Assert.assertEquals("resultList", reader.readString());
View Full Code Here


   
    Assert.assertEquals("pagecount", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    Assert.assertEquals("pageindex", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    Assert.assertEquals("resultList", reader.readString());
    Assert.assertTrue(reader.readObject() instanceof JSONArray);
   
    Assert.assertEquals("totalCount", reader.readString());
View Full Code Here

   
    Assert.assertEquals("pageindex", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    Assert.assertEquals("resultList", reader.readString());
    Assert.assertTrue(reader.readObject() instanceof JSONArray);
   
    Assert.assertEquals("totalCount", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    reader.endObject();
View Full Code Here

   
    Assert.assertEquals("resultList", reader.readString());
    Assert.assertTrue(reader.readObject() instanceof JSONArray);
   
    Assert.assertEquals("totalCount", reader.readString());
    Assert.assertEquals(0, reader.readObject());
   
    reader.endObject();
   
    reader.close();
  }
View Full Code Here

       

        {
            Exception error = null;
            try {
                reader.readObject(VO.class);
            } catch (Exception ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

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

   
    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

        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());
            Assert.assertEquals(100, vo.getScreenHeight());
            Assert.assertEquals(12, vo.getScreenWidth());
            Assert.assertEquals("11", vo.getTag());
View Full Code Here

        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);
            } else {
                want.fail("not possible");
            }
View Full Code Here

        reader.startArray();
        while (reader.hasNext()) {
            if (oneDates == null) {
                oneDates = reader.readObject(byte[].class);
            } else if (twoDates == null) {
                twoDates = reader.readObject(byte[].class);
            } else {
                want.fail("not possible");
            }

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