org.h2.util.json

## Class JsonConstructorUtils

- java.lang.Object
- - org.h2.util.json.JsonConstructorUtils

    public final class JsonConstructorUtils
    extends java.lang.Object

Utilities for JSON constructors.

### Field Summary

Fields
`static int` `JSON_ABSENT_ON_NULL` The ABSENT ON NULL flag.
`static int` `JSON_WITH_UNIQUE_KEYS` The WITH UNIQUE KEYS flag.

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `jsonArrayAppend(java.io.ByteArrayOutputStream baos, Value value, int flags)` Appends a value to a JSON array in the specified output stream.
`static void` `jsonObjectAppend(java.io.ByteArrayOutputStream baos, java.lang.String key, Value value)` Appends a value to a JSON object in the specified string builder.
`static Value` `jsonObjectFinish(java.io.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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### JSON_ABSENT_ON_NULL

    public static final int JSON_ABSENT_ON_NULL

The ABSENT ON NULL flag.

See Also:
  Constant Field Values

#### JSON_WITH_UNIQUE_KEYS

    public static final int JSON_WITH_UNIQUE_KEYS

The WITH UNIQUE KEYS flag.

See Also:
  Constant Field Values

### Method Detail

#### jsonObjectAppend

    public static void jsonObjectAppend(java.io.ByteArrayOutputStream baos,
                                        java.lang.String key,
                                        Value value)

Appends a value to a JSON object in the specified string builder.

Parameters:
  `baos` - the output stream to append to
  `key` - the name of the property
  `value` - the value of the property

#### jsonObjectFinish

    public static Value jsonObjectFinish(java.io.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.

Parameters:
  `baos` - the output stream with the object
  `flags` - the flags (`JSON_WITH_UNIQUE_KEYS`)
Returns:
  the JSON value
Throws:
  `DbException` - if `JSON_WITH_UNIQUE_KEYS` is specified and keys are not unique

#### jsonArrayAppend

    public static void jsonArrayAppend(java.io.ByteArrayOutputStream baos,
                                       Value value,
                                       int flags)

Appends a value to a JSON array in the specified output stream.

Parameters:
  `baos` - the output stream to append to
  `value` - the value
  `flags` - the flags (`JSON_ABSENT_ON_NULL`)