INNER CODE UNIT · Java

MapUtils

react-native-webrtc/react-native-callkeep · android/src/main/java/io/wazo/callkeep/MapUtils.java:14

public class MapUtils {
    // @see https://gist.github.com/viperwarp/2beb6bbefcc268dee7ad
    public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
        WritableMap map = new WritableNativeMap();

        Iterator<String> iterator = jsonObject.keys();
        while (iterator.hasNext()) {
            String key = iterator.next();
            Object value = jsonObject.get(key);
            if (value instanceof JSONObject) {
                map.putMap(key, convertJsonToMap((JSONObject) value));
            } else if (value instanceof  Boolean) {
                map.putBoolean(key, (Boolean) value);
            } else if (value instanceof  Integer) {
                map.putInt(key, (Integer) value);
            } else if (value instanceof  Double) {
                map.putDouble(key, (Double) value);
            } else if (value instanceof String)  {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…