Package com.alibaba.druid.support.json

Examples of com.alibaba.druid.support.json.JSONParser


import com.alibaba.druid.support.json.JSONParser;

public class JSONParserTest extends TestCase {

    public void test_parse() throws Exception {
        JSONParser parser = new JSONParser("{ \"id\":33,\"name\":\"jobs\",\"values\":[1,2,3,4], \"f1\":true, \"f2\":false,\"f3\":-234,\"f4\":3.5}");
        Map<String, Object> map = (Map<String, Object>) parser.parse();
        Assert.assertEquals(33, map.get("id"));
        Assert.assertEquals("jobs", map.get("name"));
        Assert.assertEquals(4, ((List) map.get("values")).size());
        Assert.assertEquals(1, ((List) map.get("values")).get(0));
        Assert.assertEquals(2, ((List) map.get("values")).get(1));
View Full Code Here

TOP

Related Classes of com.alibaba.druid.support.json.JSONParser

Copyright © 2018 www.massapicom. 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.