src/main/java/de/dosmike/sponge/megamenus/api/state/StateObject.java
public JsonElement toJson() {
        JsonObject root = new JsonObject();

        for (Map.Entry<String, Serializable> e : state.entrySet()) {
            String key = e.getKey();
            Serializable value = e.getValue();
            if (value instanceof BigInteger) {
                root.addProperty("BI:"+key, (Number)value);
            } else if (value instanceof BigDecimal) {
                root.addProperty("BD:"+key, (Number)value);
            } else if (value instanceof Boolean) {
                root.addProperty("t:"+key, (Boolean)value);
            } else if (value instanceof Byte) {
                root.addProperty("b:"+key, (Number)value);
            } else if (value instanceof Short) {
                root.addProperty("s:"+key, (Number)value);
            } else if (value instanceof Integer) {
                root.addProperty("i:"+key, (Number)value);
            } else if (value instanceof Long) {
                root.addProperty("l:"+key, (Number)value);
            } else if (value instanceof Float) {
                root.addProperty("f:"+key, (Number)value);
            } else if (value instanceof Double) {
                root.addProperty("d:"+key, (Number)value);
            } else if (value instanceof String) {
                root.addProperty("S:"+key, (String)value);
            } else if (value instanceof UUID) {
                root.addProperty("U:"+key, ((UUID)value).toString());
            } else {
                try {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    ObjectOutputStream oos = new ObjectOutputStream(baos);
                    root.addProperty("O:" + key, new String(Base64.getEncoder().encode(baos.toByteArray())));
                } catch (IOException except) {
                    throw new RuntimeException("Could not serialize State to Json", except);
                }
            }
        }
        return root;
    }
/**
     * Convert this StateObject into an JsonObject
     * @return this as Json
     */
Convert this StateObject into an JsonObject
@return this as Json
Convert this StateObject into an JsonObject @return this as Json
public JsonElement toJson() {
        JsonObject root = new JsonObject();
        for (Map.Entry<String, Serializable> e : state.entrySet()) {
            String key = e.getKey();
            Serializable value = e.getValue();
            if (value instanceof BigInteger) {
                root.addProperty("BI:"+key, (Number)value);
            } else if (value instanceof BigDecimal) {
                root.addProperty("BD:"+key, (Number)value);
            } else if (value instanceof Boolean) {
                root.addProperty("t:"+key, (Boolean)value);
            } else if (value instanceof Byte) {
                root.addProperty("b:"+key, (Number)value);
            } else if (value instanceof Short) {
                root.addProperty("s:"+key, (Number)value);
            } else if (value instanceof Integer) {
                root.addProperty("i:"+key, (Number)value);
            } else if (value instanceof Long) {
                root.addProperty("l:"+key, (Number)value);
            } else if (value instanceof Float) {
                root.addProperty("f:"+key, (Number)value);
            } else if (value instanceof Double) {
                root.addProperty("d:"+key, (Number)value);
            } else if (value instanceof String) {
                root.addProperty("S:"+key, (String)value);
            } else if (value instanceof UUID) {
                root.addProperty("U:"+key, ((UUID)value).toString());
            } else {
                try {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    ObjectOutputStream oos = new ObjectOutputStream(baos);
                    root.addProperty("O:" + key, new String(Base64.getEncoder().encode(baos.toByteArray())));
                } catch (IOException except) {
                    throw new RuntimeException("Could not serialize State to Json", except);
                }
            }
        }
        return root;
    }
public JsonElement toJson ( ) { JsonObject root = new JsonObject ( ) ; for ( Map . Entry < String , Serializable > e : state . entrySet ( ) ) { String key = e . getKey ( ) ; Serializable value = e . getValue ( ) ; if ( value instanceof BigInteger ) { root . addProperty ( "BI:" + key , ( Number ) value ) ; } else if ( value instanceof BigDecimal ) { root . addProperty ( "BD:" + key , ( Number ) value ) ; } else if ( value instanceof Boolean ) { root . addProperty ( "t:" + key , ( Boolean ) value ) ; } else if ( value instanceof Byte ) { root . addProperty ( "b:" + key , ( Number ) value ) ; } else if ( value instanceof Short ) { root . addProperty ( "s:" + key , ( Number ) value ) ; } else if ( value instanceof Integer ) { root . addProperty ( "i:" + key , ( Number ) value ) ; } else if ( value instanceof Long ) { root . addProperty ( "l:" + key , ( Number ) value ) ; } else if ( value instanceof Float ) { root . addProperty ( "f:" + key , ( Number ) value ) ; } else if ( value instanceof Double ) { root . addProperty ( "d:" + key , ( Number ) value ) ; } else if ( value instanceof String ) { root . addProperty ( "S:" + key , ( String ) value ) ; } else if ( value instanceof UUID ) { root . addProperty ( "U:" + key , ( ( UUID ) value ) . toString ( ) ) ; } else { try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; root . addProperty ( "O:" + key , new String ( Base64 . getEncoder ( ) . encode ( baos . toByteArray ( ) ) ) ) ; } catch ( IOException except ) { throw new RuntimeException ( "Could not serialize State to Json" , except ) ; } } } return root ; }
Convert this StateObject into an JsonObject
 @return this as Json
Convert this StateObject into an JsonObject @return this as Json