|
|
@ -218,6 +218,7 @@ public class JSONUtils {
|
|
|
|
int arrayIndex = 0;
|
|
|
|
int arrayIndex = 0;
|
|
|
|
boolean isArray = false;
|
|
|
|
boolean isArray = false;
|
|
|
|
String fieldName = null;
|
|
|
|
String fieldName = null;
|
|
|
|
|
|
|
|
boolean removeNode = val == null || fieldType == 255;
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject node = jsonObject;
|
|
|
|
JSONObject node = jsonObject;
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -235,7 +236,7 @@ public class JSONUtils {
|
|
|
|
fieldName = fields[i].substring(0, pos);
|
|
|
|
fieldName = fields[i].substring(0, pos);
|
|
|
|
arrayIndex = Integer.parseInt(fields[i].substring(pos + 1, pos2 - pos - 1));
|
|
|
|
arrayIndex = Integer.parseInt(fields[i].substring(pos + 1, pos2 - pos - 1));
|
|
|
|
|
|
|
|
|
|
|
|
if (!node.has(fieldName) && val == null) {
|
|
|
|
if (!node.has(fieldName) && removeNode) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONArray jsonArray = node.optJSONArray(fieldName);
|
|
|
|
JSONArray jsonArray = node.optJSONArray(fieldName);
|
|
|
@ -250,7 +251,7 @@ public class JSONUtils {
|
|
|
|
node = jsonArray.optJSONObject(arrayIndex);
|
|
|
|
node = jsonArray.optJSONObject(arrayIndex);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (!node.has(fields[i])) {
|
|
|
|
if (!node.has(fields[i])) {
|
|
|
|
if (val == null)
|
|
|
|
if (removeNode)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
node.put(fields[i], new JSONObject());
|
|
|
|
node.put(fields[i], new JSONObject());
|
|
|
@ -261,10 +262,10 @@ public class JSONUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (node == null) {
|
|
|
|
if (node == null) {
|
|
|
|
return (val == null);
|
|
|
|
return removeNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (val == null) {
|
|
|
|
if (removeNode) {
|
|
|
|
node.remove(fields[i]);
|
|
|
|
node.remove(fields[i]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
node.put(fields[i], val);
|
|
|
|
node.put(fields[i], val);
|
|
|
|