Examples of parseArray()


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

        ArrayList list = new ArrayList();
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArray(String.class, list);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

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

        DefaultExtJSONParser parser = new DefaultExtJSONParser("{1,null }");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArray(new Type[] { String.class });
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

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

        DefaultExtJSONParser parser = new DefaultExtJSONParser("{1}");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArray(new Type[] {});
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

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

        DefaultExtJSONParser parser = new DefaultExtJSONParser("[1,2,3 4]");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArray(new Type[] { Integer.class });
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

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

        String[] tests = { "[1,2,3]", "[1,,2,3]", "[1,2,,,3]", "[1 2,,,3]", "[1 2 3]", "[1, 2, 3,,]", "[,,1, 2, 3,,]", };

        for (String t : tests) {
            DefaultExtJSONParser ext = new DefaultExtJSONParser(t);
            ext.config(Feature.AllowArbitraryCommas, true);
            List<Object> extRes = ext.parseArray(Object.class);
            Assert.assertEquals(res, extRes);

            DefaultJSONParser basic = new DefaultJSONParser(t);
            basic.config(Feature.AllowArbitraryCommas, true);
            List<Object> basicRes = new ArrayList<Object>();
View Full Code Here

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

    public void test_error_0() throws Exception {
        Exception error = null;
        try {
            String text = "[{\"old\":false,\"name\":\"校长\",\"age\":3,\"salary\":123456789.0123]";
            DefaultExtJSONParser parser = new DefaultExtJSONParser(text);
            parser.parseArray(User.class);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

Examples of com.alibaba.fastjson.parser.DefaultJSONParser.parseArray()

            array = null;
        } else if (lexer.token() == JSONToken.EOF) {
            array = null;
        } else {
            array = new JSONArray();
            parser.parseArray(array);

            handleResovleTask(parser, array);
        }

        parser.close();
View Full Code Here

Examples of com.alibaba.fastjson.parser.DefaultJSONParser.parseArray()

        if (lexer.token() == JSONToken.NULL) {
            lexer.nextToken();
            list = null;
        } else {
            list = new ArrayList<T>();
            parser.parseArray(clazz, list);

            handleResovleTask(parser, list);
        }

        parser.close();
View Full Code Here

Examples of com.alibaba.fastjson.parser.DefaultJSONParser.parseArray()

        }

        List<Object> list;

        DefaultJSONParser parser = new DefaultJSONParser(text, ParserConfig.getGlobalInstance());
        Object[] objectArray = parser.parseArray(types);
        if (objectArray == null) {
            list = null;
        } else {
            list = Arrays.asList(objectArray);
        }
View Full Code Here

Examples of com.alibaba.fastjson.parser.DefaultJSONParser.parseArray()

            array = null;
        } else if (lexer.token() == JSONToken.EOF) {
            array = null;
        } else {
            array = new JSONArray();
            parser.parseArray(array);

            handleResovleTask(parser, array);
        }

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