hello,
While converting JSON to Avro, I confronted with a difficulty.
I have only a little bit knowledge about Avro. May be what I am trying to
do is an absurdity in Avro perspective.
kindly, shed some light into these two doubts.
1) How can I specify the schema of a JSON that may change( not schema
evolution, user can add their own custom fields).
2) Is it possible to to convert a JSON which have a undefined portion
inside a well defined JSON(we can able to generate the schema by inspecting
the entire JSON but doing the inspection in each request is a worst case
scenario because of custom fields are rare case).
My case
I have a order JSON like this.
{
"items" : [
{
"name" : "mobile phone",
"price" : 25000
},
{
"name" : "Memmory card",
"price" : 1000
}
],
"date" : "2016-07-14",
"price" : 26000
}
Even though user can be able to add some custom fields at any time.
Then order JSON may look like this
{
"items" : [
{
"name" : "mobile phone",
"price" : 25000
},
{
"name" : "Memory card",
"price" : 1000
}
],
"date" : "2016-07-14",
"new_custom_property_1" : "val1",
"new_custom_property_7" : {
"new_custom_property_3" : 13
},
"price" : 26000
}
Apparently the JSON conversion will fail at the place of new unknown field
"new_custom_property_1".
How can I write the Avro schema for this kind of JSON?
How do you guys deal with this kind of situations?
Please give me some insights.
Thanks