2

Hi i have a JSONObject that i have converted to a JSON Array and i'm wanting to know how to loop through the whole array find any instances of null and replace it with ""?

heres what i have so far but not sure where to go from here

JSONObject fullNetworkfile = fullNetworkDataFromFile;
     JSONArray fullNetworkArray = new JSONArray();
     fullNetworkArray.put(fullNetworkfile);
1

1 Answer 1

5
for (int i = 0; i < fullNetworkArray.length(); i++) {
    Object network = fullNetworkArray.get(i);
    if (network == null) {
        fullNetworkArray.put(i, "");
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.