1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

* Adds protected entrySet accessor to JSONObject

* Updates loops that request key/value pairs to use the new entrySet accessor
This commit is contained in:
John J. Aylward 2017-05-22 00:50:39 -04:00
parent fbd2be7431
commit 4f5bf16676
7 changed files with 95 additions and 88 deletions

View file

@ -25,7 +25,7 @@ SOFTWARE.
*/
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties;
/**
@ -61,10 +61,11 @@ public class Property {
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties = new Properties();
if (jo != null) {
Iterator<String> keys = jo.keys();
while (keys.hasNext()) {
String name = keys.next();
properties.put(name, jo.getString(name));
for (final Entry<String, ?> entry : jo.entrySet()) {
Object value = entry.getValue();
if (!JSONObject.NULL.equals(value)) {
properties.put(entry.getKey(), value.toString());
}
}
}
return properties;