public static ContextSet deserialize(JsonElement element) {
        Preconditions.checkArgument(element.isJsonObject());
        JsonObject jsonObject = element.getAsJsonObject();

        Set<Map.Entry<String, JsonElement>> entries = jsonObject.entrySet();
        if (entries.isEmpty()) {
            return ImmutableContextSetImpl.EMPTY;
        }

        MutableContextSet contextSet = new MutableContextSetImpl();
        for (Map.Entry<String, JsonElement> entry : entries) {
            String k = entry.getKey();
            JsonElement v = entry.getValue();

            if (v.isJsonArray()) {
                JsonArray values = v.getAsJsonArray();
                for (JsonElement value : values) {
                    contextSet.add(k, value.getAsString());
                }
            } else {
                contextSet.add(k, v.getAsString());
            }
        }

        return contextSet;
    }
Serializes and deserializes {@link ContextSet}s to and from JSON.

<p>The entries within the serialized output are sorted, this ensures that any two invocations
of {@link #serialize(ContextSet)} with the same {@link ContextSet} will produce
the same exact JSON string.</p>
common/src/main/java/me/lucko/luckperms/common/context/serializer/ContextSetJsonSerializer.java