private static String jsonValue(Object in) {
        // in is nullable, a field can certainly be null
        final String value;

        if (in == null) {
            value = "null";
        } else if (in instanceof Optional<?>) {
            final Optional<?> o = (Optional<?>) in;
            return o.map(JsonEncoderImpl::jsonValue).orElse("null");
        } else if (NON_STRING_CLASSES.contains(in.getClass())) {
            value = String.valueOf(in);
        } else {
            value = "\"" + String.valueOf(in).replace("\"", "\\\"") + "\"";
        }
        return value;
    }
Parse the specified value into JSON.

@param in  the value
@return    the JSON encoded value
plugin-parent/json-stream/src/main/java/com/speedment/plugins/json/internal/JsonEncoderImpl.java