目前,我使用以下命令从json对象获取特定数据。我把密钥作为数据库中的主键。
"10005": {
"test": {
"status": "C",
"value": "2021/01/05",
"currency": "USD",
"amount": 35000.0
},
String key = keys.next();
if (jsonObject.get(key) instanceof JSONObject) {
JSONObject object = (JSONObject) jsonObject.get(key);
Iterator<String> keysInside = object.keys();
while (keysInside.hasNext()) {
String keyIn = keysInside.next();
if (object.get(keyIn) instanceof JSONObject) {
JSONObject objectInside = (JSONObject) object.get(keyIn);
switch (keyIn) {
case "test_1":
如果json对象有另一个这样的循环,我该如何迭代
{
"10005": {
"001": {
"test": {
"staus": "C",
"value": "2021/01/05",
"currency": "USD",
"amount": 35000.0
},
暂无答案!
目前还没有任何答案,快来回答吧!