The json
output format in Bottled Water is a literal json representation of an Avro formatted message. This can be highly inconvenient to parse. Here is an example of the current output.
{
"id": {
"long": 3688267
},
"language": {
"string": "en_US"
},
"created": {
"DateTime": {
"year": "2017",
"month": "03",
"date": "14",
"hour": "15",
"minute": "42",
"second": "49",
"micro": "230990"
}
}
}
In the example, the value of each attribute (id
, language
, and created
) is a dict with one item whose key is the value type, and value is the actual value. This requires readers to either know ahead of time what the value type of each attribute is in order to get the underlying value, or infer the value key by iterating or searching over the dict.
It would be convenient if there is an option to directly emit the value of each attribute, like the following.
{
"id": 3688267,
"language": "en_US",
"created": {
"year": "2017",
"month": "03",
"date": "14",
"hour": "15",
"minute": "42",
"second": "49",
"micro": "230990"
}
}
Or, if it is desirable to preserve the type information, organize it as a list/array/tuple, so that it is easy to get the type and underlying value without needing fore-knowledge or potentially expensive operations over dict.
{
"id": ["long", 3688267],
"language": ["string", "en_US"],
"created": ["DateTime", {
"year": "2017",
"month": "03",
"date": "14",
"hour": "15",
"minute": "42",
"second": "49",
"micro": "230990"
}]
}