首页 > 文档 > loadJSONObject()读取数据库对象
2017
07-14

loadJSONObject()读取数据库对象

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()


 



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。