public final class JSONFormat extends Object
The default format is the following, using header()
equal to
true
and applying JSONFormat.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 JSONFormat.RecordFormat.ARRAY
:
[[value-1-1,value-1-2,...,value-1-n],
[value-2-1,value-2-2,...,value-2-n]]
or, using JSONFormat.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}]
Modifier and Type | Class and Description |
---|---|
static class |
JSONFormat.RecordFormat
The format of individual JSON records.
|
Constructor and Description |
---|
JSONFormat() |
Modifier and Type | Method and Description |
---|---|
boolean |
header()
Whether to emit a header row with column names, defaulting to
true . |
JSONFormat |
header(boolean newHeader)
Whether to emit a header row with column names, defaulting to
true . |
JSONFormat.RecordFormat |
recordFormat()
The record format to be applied, defaulting to
JSONFormat.RecordFormat.ARRAY . |
JSONFormat |
recordFormat(JSONFormat.RecordFormat newRecordFormat)
The record format to be applied, defaulting to
JSONFormat.RecordFormat.ARRAY . |
public JSONFormat header(boolean newHeader)
true
.public boolean header()
true
.public JSONFormat recordFormat(JSONFormat.RecordFormat newRecordFormat)
JSONFormat.RecordFormat.ARRAY
.public JSONFormat.RecordFormat recordFormat()
JSONFormat.RecordFormat.ARRAY
.Copyright © 2017. All Rights Reserved.