Questions tagged «json-simple»


14
如何使用简单的JSON库将JSON文件读入Java
我想JSON使用JSON简单库使用Java读取此文件。 我的JSON文件如下所示: [ { "name":"John", "city":"Berlin", "cars":[ "audi", "bmw" ], "job":"Teacher" }, { "name":"Mark", "city":"Oslo", "cars":[ "VW", "Toyata" ], "job":"Doctor" } ] 这是我为读取此文件而编写的Java代码: package javaapplication1; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class JavaApplication1 { public static void main(String[] args) …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.