mirror of
https://github.com/stleary/JSON-java.git
synced 2026-01-24 00:03:17 -05: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user