for
(
int
i
= 0;
i
<
jsonArray
.size();
i
++) {
String
rep
=
jsonArray
.get(
i
).toString();
String
replace
=
""
;
String
city
=
"\"city\":"
;
String
sum
=
"\"detailsum\":"
;
String
reward
=
""
;
replace
=
rep
.replace(
"["
,
""
).replace(
"]"
,
""
);
String[]
sp
=
replace
.split(
","
);
String
re1
=
city
+
sp
[0].toString();
String
re2
=
sum
+
sp
[1].toString();
reward
=
"{"
+
re1
+
","
+
re2
+
"}"
;
JSONObject
jsonObject
= JSONObject.fromObject(
reward
);
//
JSONArray
jsonarray
= JSONArray.fromObject(
actinfo
);
jsonArray
.set(
i
,
jsonObject
);
}
通过以上方法可以将string取出然后化为单独jsonobject或jsonarray类型