All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ardoq.adapter.JsonUtils Maven / Gradle / Ivy

There is a newer version: 1.26
Show newest version
package com.ardoq.adapter;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import java.util.Map;
import java.util.Set;

public class JsonUtils {

    /**
     * Removes keys from json object if they have null values. Won't touch fields as users may want to explicitly set them to null
     *
     * @param jsonObject
     */
    public static void removeReservedNullVaules(JsonObject jsonObject) {
        Set> entries = jsonObject.entrySet();
        for (Map.Entry entry : entries) {
            if (entry.getValue().isJsonNull()) {
                jsonObject.remove(entry.getKey());
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy