The default format is the following, using header() equal to
true and applying RecordFormat#ARRAY:
{"fields":[{"name":"field-1","type":"type-1"},
{"name":"field-2","type":"type-2"},
...,
{"name":"field-n","type":"type-n"}],
"records":[[value-1-1,value-1-2,...,value-1-n],
[value-2-1,value-2-2,...,value-2-n]]}
If header() is set to false, then the result is simply
the records array, either using RecordFormat#ARRAY:
[[value-1-1,value-1-2,...,value-1-n],
[value-2-1,value-2-2,...,value-2-n]]
or, using RecordFormat#OBJECT:
[{"field-1": value-1-1, "field-2": value-1-2,..., "field-n": value-1-n},
{"field-1": value-2-1, "field-2": value-2-2,..., "field-n": value-2-n}]
The type is immutable, meaning calls to setters like header(boolean)
do not modify the original reference, but return a new one instead.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | JSONFormat.RecordFormat
The format of individual JSON records. |
| Modifier and Type | Field and Description |
|---|---|
| public static final JSONFormat | |
| public static final JSONFormat | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv String[] | |
| pack-priv final boolean | |
| pack-priv String | |
| pack-priv boolean | |
| pack-priv JSONFormat. | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| private | JSONFormat(boolean mutable, boolean format, String newline, int globalIndent, int indent, String[] indented, boolean header, JSONFormat.
|
| Modifier and Type | Method and Description |
|---|---|
| public final @NotNull JSONFormat | |
| public final boolean | |
| public final @NotNull JSONFormat | globalIndent(int newGlobalIndent)
The new global indentation size applied on all levels, defaulting to |
| public final int | |
| public final @NotNull JSONFormat | |
| public final boolean | |
| public final @NotNull JSONFormat | |
| public final int | |
| public final @NotNull String | |
| public final boolean | |
| public final @NotNull JSONFormat | |
| public final @NotNull JSONFormat | |
| public final @NotNull String | |
| public final @NotNull JSONFormat | quoteNested(boolean newQuoteNested)
Whether nested |
| public final boolean | quoteNested()
Whether nested |
| public final @NotNull JSONFormat | recordFormat(JSONFormat.
The record format to be applied, defaulting to
|
| public final @NotNull JSONFormat. | |
| public final @NotNull JSONFormat | wrapSingleColumnRecords(boolean newWrapSingleColumnRecords)
Whether to wrap single column records in the |
| public final boolean |
| DEFAULT_FOR_RECORDS | back to summary |
|---|---|
| public static final JSONFormat DEFAULT_FOR_RECORDS | |
| DEFAULT_FOR_RESULTS | back to summary |
|---|---|
| public static final JSONFormat DEFAULT_FOR_RESULTS | |
| format | back to summary |
|---|---|
| pack-priv boolean format | |
| globalIndent | back to summary |
|---|---|
| pack-priv int globalIndent | |
| header | back to summary |
|---|---|
| pack-priv boolean header | |
| indent | back to summary |
|---|---|
| pack-priv int indent | |
| indented | back to summary |
|---|---|
| pack-priv String[] indented | |
| mutable | back to summary |
|---|---|
| pack-priv final boolean mutable | |
| newline | back to summary |
|---|---|
| pack-priv String newline | |
| quoteNested | back to summary |
|---|---|
| pack-priv boolean quoteNested | |
| recordFormat | back to summary |
|---|---|
| pack-priv JSONFormat. | |
| wrapSingleColumnRecords | back to summary |
|---|---|
| pack-priv boolean wrapSingleColumnRecords | |
| JSONFormat | back to summary |
|---|---|
| public JSONFormat() | |
| JSONFormat | back to summary |
|---|---|
| private JSONFormat(boolean mutable, boolean format, String newline, int globalIndent, int indent, String[] indented, boolean header, JSONFormat. | |
| format | back to summary |
|---|---|
| public final @NotNull JSONFormat format(boolean newFormat) The new value for the formatting flag, defaulting to
| |
| format | back to summary |
|---|---|
| public final boolean format() The formatting flag. | |
| globalIndent | back to summary |
|---|---|
| public final @NotNull JSONFormat globalIndent(int newGlobalIndent) The new global indentation size applied on all levels, defaulting to
| |
| globalIndent | back to summary |
|---|---|
| public final int globalIndent() The global indentation applied on all levels. | |
| header | back to summary |
|---|---|
| public final @NotNull JSONFormat header(boolean newHeader) Whether to emit a header row with column names, defaulting to
| |
| header | back to summary |
|---|---|
| public final boolean header() Whether to emit a header row with column names, defaulting to
| |
| indent | back to summary |
|---|---|
| public final @NotNull JSONFormat indent(int newIndent) The new indentation size per level value, defaulting to
| |
| indent | back to summary |
|---|---|
| public final int indent() The indentation size per level. | |
| indentString | back to summary |
|---|---|
| public final @NotNull String indentString(int level) Convenience method to get an indentation string at a given level.
| |
| mutable | back to summary |
|---|---|
| public final boolean mutable() Whether this configuration object is mutable. | |
| mutable | back to summary |
|---|---|
| public final @NotNull JSONFormat mutable(boolean newMutable) The new value for the mutable flag, defaulting to
| |
| newline | back to summary |
|---|---|
| public final @NotNull JSONFormat newline(String newNewline) The new newline character, defaulting to
| |
| newline | back to summary |
|---|---|
| public final @NotNull String newline() The formatting flag.
| |
| quoteNested | back to summary |
|---|---|
| public final @NotNull JSONFormat quoteNested(boolean newQuoteNested) Whether nested
| |
| quoteNested | back to summary |
|---|---|
| public final boolean quoteNested() Whether nested | |
| recordFormat | back to summary |
|---|---|
| public final @NotNull JSONFormat recordFormat(JSONFormat. The record format to be applied, defaulting to
| |
| recordFormat | back to summary |
|---|---|
| public final @NotNull JSONFormat. The record format to be applied, defaulting to
| |
| wrapSingleColumnRecords | back to summary |
|---|---|
| public final @NotNull JSONFormat wrapSingleColumnRecords(boolean newWrapSingleColumnRecords) Whether to wrap single column records in the
| |
| wrapSingleColumnRecords | back to summary |
|---|---|
| public final boolean wrapSingleColumnRecords() Whether to wrap single column records in the | |
| Modifier and Type | Field and Description |
|---|---|
| public static final JSONFormat. | ARRAY
A record is a JSON array. |
| public static final JSONFormat. | OBJECT
A record is a JSON object. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static JSONFormat. | |
| public static JSONFormat. |
| ARRAY | back to summary |
|---|---|
| public static final JSONFormat. A record is a JSON array.
This format allows for accessing columns by index, saving space by
avoiding repetitive column names in large result sets. Use this
preferrably with | |
| OBJECT | back to summary |
|---|---|
| public static final JSONFormat. A record is a JSON object. This format allows for accessing columns by name, repeating column names in each record. | |
| RecordFormat | back to summary |
|---|---|
| private RecordFormat() | |
| valueOf | back to summary |
|---|---|
| public static JSONFormat. | |
| values | back to summary |
|---|---|
| public static JSONFormat. | |