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

Updates for supporting the Android API

This commit is contained in:
John J. Aylward 2017-06-21 11:52:15 -04:00
parent 5024f2d210
commit e8b1b66888
9 changed files with 198 additions and 101 deletions

View file

@ -25,7 +25,6 @@ SOFTWARE.
*/
import java.util.Enumeration;
import java.util.Map.Entry;
import java.util.Properties;
/**
@ -61,10 +60,11 @@ public class Property {
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties = new Properties();
if (jo != null) {
for (final Entry<String, ?> entry : jo.entrySet()) {
Object value = entry.getValue();
// Don't use the new entrySet API to maintain Android support
for (final String key : jo.keySet()) {
Object value = jo.opt(key);
if (!JSONObject.NULL.equals(value)) {
properties.put(entry.getKey(), value.toString());
properties.put(key, value.toString());
}
}
}