3-7.loadJSONObject()
Name(名称):loadJSONObject()读取数据库对象
Examples(例子):
// The following short JSON file called “data.json” is parsed
// in the code below. It must be in the project’s “data” folder.
//
// {
// “id”: 0,
// “species”: “Panthera leo”,
// “name”: “Lion”
// }
JSONObject json;
void setup() {
json = loadJSONObject(“data.json”);
int id = json.getInt(“id”);
String species = json.getString(“species”);
String name = json.getString(“name”);
println(id + “, ” + species + “, ” + name);
}
// Sketch prints:
// 0, Panthera leo, Lion
Description(描述):Loads a JSON from the data folder or a URL, and returns a JSONObject.
从数据文件夹或URL加载JSON,并返回一个JSONObject。
All files loaded and saved by the Processing API use UTF-8 encoding.
Processing API加载和保存的所有文件都使用UTF-8编码。
Syntax(语法):loadJSONObject(filename)
loadJSONObject(file)
Parameters (参数):filename——name of a file in the data folder or a URL数据文件夹中的文件名或URL
Returns(返回值):JSONObject
Related(相关函数):JSONObject
JSONArray
loadJSONArray()
saveJSONObject()
saveJSONArray()
- 本文固定链接: http://iprocessing.cn/2017/07/14/loadjsonobject读取数据库对象/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表