我需要将JSONArray对象存储为字符串,然后检索字符串并将其转换回JSONArray.
如果我做:
JSONArray jArray;
String s = jArray.toString()
JSONArray newJArray = new JSONArray(s);
Run Code Online (Sandbox Code Playgroud)
我会找回同一个物体吗?
我正在尝试将JSONArray存储在SQLite数据库中.
这就是我正在看的东西.http://developer.android.com/reference/org/json/JSONArray.html#toString()
我想读这一JSON行,但因为它开头JSONArray我有点困惑
"abridged_cast": [
{
"name": "Jeff Bridges",
"id": "162655890",
"characters": [
"Jack Prescott"
]
},
{
"name": "Charles Grodin",
"id": "162662571",
"characters": [
"Fred Wilson"
]
},
{
"name": "Jessica Lange",
"id": "162653068",
"characters": [
"Dwan"
]
},
{
"name": "John Randolph",
"id": "162691889",
"characters": [
"Capt. Ross"
]
},
{
"name": "Rene Auberjonois",
"id": "162718328",
"characters": [
"Bagley"
]
}
],
Run Code Online (Sandbox Code Playgroud)
我只需要使用"名称"并将所有内容保存为一个字符串.(字符串值将是:Jeff Bridges,Charles Grodin,Jessica Lange,John Randolph,Rene Auberjonois).
这是我的代码:
try {
//JSON is the JSON code …Run Code Online (Sandbox Code Playgroud)