In NiFi (1.5) I need the best way to prepare JSON so it can be parsed by the Hive json serde ('org.apache.hive.hcatalog.data.JsonSerDe).
I have an array of, here two, records in this format (from a REST API response).
[
{
"id": 1,
"call_status": "OK",
"result": 0.0239,
"explanation": [
"some_var",
"another_var"
],
"foo": "OK"
},
{
"id": 2,
"call_status": "OK",
"result": 0.0239,
"explanation": [
"some_var",
"another_var"
],
"foo": "OK"
}
]
It seems it should be transformed to this format for the serde to work, which I tried doing manually with succes. No array brackets and one record per line.
{ "id": 1, "call_status": "OK", "result": 0.0239, "explanation": [ "some_var", "another_var" ], "foo": "OK" }
{ "id": 2, "call_status": "OK", "result": 0.0239, "explanation": [ "some_var", "another_var" ], "foo": "OK" }
What is the recommended / most efficient way of doing this transformation? Preferably without having to input the schema, as it would be nice with a generic solution. If a schema _is_ required, let's say for Record processors, I'll live with that.