您好我有一个JSONObject,我已经转换为JSON数组,我想知道如何遍历整个数组找到任何null实例并用“”替换它?
到目前为止,这是我所拥有的,但不知道从哪里开始JSONObject fullNetworkfile = fullNetworkDataFromFile;
JSONArray fullNetworkArray = new JSONArray();
fullNetworkArray.put(fullNetworkfile);
答案 0 :(得分:5)
for (int i = 0; i < fullNetworkArray.length(); i++) {
Object network = fullNetworkArray.get(i);
if (network == null) {
fullNetworkArray.put(i, "");
}
}