解析json依赖

       <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.70</version>
        </dependency>

String path = "/countries_list.json";
        JSONArray json = null;
        InputStream config = getClass().getResourceAsStream(path);
        if (config == null) {
            new BaseException("读取文件失败");
        } else {
         json = JSON.parseObject(config, JSONArray.class);
        }
上一篇 下一篇