Package com.alibaba.fastjson

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


   
    public void test_obj_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"val\":{\"val\":{\"id\":123}}}"));

        reader.startObject();
        Assert.assertEquals("val", reader.readString());
       
        reader.startObject();
        Assert.assertEquals("val", reader.readString());

        reader.startObject();
View Full Code Here


        reader.startObject();
        Assert.assertEquals("val", reader.readString());
       
        reader.startObject();
        Assert.assertEquals("val", reader.readString());

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Long.valueOf(123), reader.readLong());
        reader.endObject();
View Full Code Here

       
        reader.startObject();
        Assert.assertEquals("val", reader.readString());

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Long.valueOf(123), reader.readLong());
        reader.endObject();

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

        JsonStroe store = new JsonStroe();
       
        JSONReader reader = new JSONReader(new StringReader(text));
        reader.startObject();
       
        String key = reader.readString();
       
        Assert.assertEquals("rec", key);
        reader.startArray();
       
        List<KeyValue> list = new ArrayList<KeyValue>();
View Full Code Here

    public void test_obj() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"id\":123}"));

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Integer.valueOf(123), reader.readInteger());
        reader.endObject();

        reader.close();
    }
View Full Code Here

    public void test_obj_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"val\":{\"id\":123}}"));

        reader.startObject();

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

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Integer.valueOf(123), reader.readInteger());
        reader.endObject();
View Full Code Here

        reader.startObject();

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

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Integer.valueOf(123), reader.readInteger());
        reader.endObject();

        reader.endObject();
View Full Code Here

        reader.startObject();

        int count = 0;
        while (reader.hasNext()) {
            String key = (String) reader.readObject();
            String value = reader.readString();
            count++;
        }
        Assert.assertEquals(10, count);

        reader.endObject();
View Full Code Here

public class JSONReader_string_1 extends TestCase {
    public void test_obj() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("\"abc\""));

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

        reader.close();
    }

}
View Full Code Here

        Assert.assertNotNull(first);
        Assert.assertNotNull(second);

        Assert.assertEquals(new Integer(3), reader.readInteger());
        Assert.assertNull(reader.readString());
       
        {
            Map<String, Object> map = new HashMap<String, Object>();
            reader.readObject(map);
            Assert.assertEquals("jobs", map.get("name"));
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.