iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/ParserUtility.java [311:338]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static JsonElement mapToJsonElement(Map<String, Object> map) throws IllegalArgumentException
    {
        Gson gson = new GsonBuilder().serializeNulls().create();
        JsonObject json = new JsonObject();

        if (map == null)
        {
            throw new IllegalArgumentException("null map to parse");
        }

        for (Map.Entry<String, Object> entry : map.entrySet())
        {
            if (entry.getValue() == null)
            {
                json.addProperty(entry.getKey(), (String)null);
            }
            else if (entry.getValue() instanceof Map)
            {
                json.add(entry.getKey(), mapToJsonElement((Map<String, Object>) entry.getValue()));
            }
            else
            {
                json.add(entry.getKey(), gson.toJsonTree(entry.getValue()));
            }
        }

        return json;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/ParserUtility.java [311:338]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static JsonElement mapToJsonElement(Map<String, Object> map) throws IllegalArgumentException
    {
        Gson gson = new GsonBuilder().serializeNulls().create();
        JsonObject json = new JsonObject();

        if (map == null)
        {
            throw new IllegalArgumentException("null map to parse");
        }

        for (Map.Entry<String, Object> entry : map.entrySet())
        {
            if (entry.getValue() == null)
            {
                json.addProperty(entry.getKey(), (String)null);
            }
            else if (entry.getValue() instanceof Map)
            {
                json.add(entry.getKey(), mapToJsonElement((Map<String, Object>) entry.getValue()));
            }
            else
            {
                json.add(entry.getKey(), gson.toJsonTree(entry.getValue()));
            }
        }

        return json;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



