Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser.config()


        String[] tests = { "{ 'a':1, 'b':2, 'c':3 }", "{ 'a':1,,'b':2, 'c':3 }", "{,'a':1, 'b':2, 'c':3 }", "{'a':1, 'b':2, 'c':3,,}",
                "{,,'a':1,,,,'b':2,,'c':3,,,,,}", };

        for (String t : tests) {
            DefaultExtJSONParser ext = new DefaultExtJSONParser(t);
            ext.config(Feature.AllowArbitraryCommas, true);

            A extRes = ext.parseObject(A.class);
            Assert.assertEquals(res, extRes);
        }
    }
View Full Code Here


public class DefaultExtJSONParserTest_3 extends TestCase {

    public void test_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v1:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getV1());
    }

    public void test_1() throws Exception {
View Full Code Here

        Assert.assertEquals(3, a.getV1());
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v1:'3'}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getV1());
    }
View Full Code Here

    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v1:'3'}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getV1());
    }

    public void test_2() throws Exception {
View Full Code Here

        Assert.assertEquals(3, a.getV1());
    }

    public void test_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v1:\"3\"}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getV1());
    }
View Full Code Here

    }

    public void test_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v1:\"3\"}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getV1());
    }

    public void test_3() throws Exception {
View Full Code Here

        Assert.assertEquals(3, a.getV1());
    }

    public void test_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{o1:{}}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(true, a.getO1() != null);
    }
View Full Code Here

    }

    public void test_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{o1:{}}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(true, a.getO1() != null);
    }

    public void test_4() throws Exception {
View Full Code Here

        Assert.assertEquals(true, a.getO1() != null);
    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v5:'3'}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }
View Full Code Here

    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v5:'3'}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }

    public void test_5() throws Exception {
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.