Package org.h2.util.json
Class JsonConstructorUtils
java.lang.Object
org.h2.util.json.JsonConstructorUtils
Utilities for JSON constructors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe ABSENT ON NULL flag.static final intThe WITH UNIQUE KEYS flag. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidjsonArrayAppend(ByteArrayOutputStream baos, Value value, int flags) Appends a value to a JSON array in the specified output stream.static voidjsonObjectAppend(ByteArrayOutputStream baos, String key, Value value) Appends a value to a JSON object in the specified string builder.static ValuejsonObjectFinish(ByteArrayOutputStream baos, int flags) Appends trailing closing brace to the specified string builder with a JSON object, validates it, and converts to a JSON value.
-
Field Details
-
JSON_ABSENT_ON_NULL
public static final int JSON_ABSENT_ON_NULLThe ABSENT ON NULL flag.- See Also:
-
JSON_WITH_UNIQUE_KEYS
public static final int JSON_WITH_UNIQUE_KEYSThe WITH UNIQUE KEYS flag.- See Also:
-
-
Method Details
-
jsonObjectAppend
Appends a value to a JSON object in the specified string builder.- Parameters:
baos- the output stream to append tokey- the name of the propertyvalue- the value of the property
-
jsonObjectFinish
Appends trailing closing brace to the specified string builder with a JSON object, validates it, and converts to a JSON value.- Parameters:
baos- the output stream with the objectflags- the flags (JSON_WITH_UNIQUE_KEYS)- Returns:
- the JSON value
- Throws:
DbException- ifJSON_WITH_UNIQUE_KEYSis specified and keys are not unique
-
jsonArrayAppend
Appends a value to a JSON array in the specified output stream.- Parameters:
baos- the output stream to append tovalue- the valueflags- the flags (JSON_ABSENT_ON_NULL)
-