42203 - Conversion of JSON to Avro failed

552 views
Skip to first unread message

Denny Britz

unread,
Mar 24, 2015, 8:42:49 AM3/24/15
to confluent...@googlegroups.com
Hello,

I have the following schema: https://gist.github.com/dennybritz/224082c5b95eed0e574c
And I'm trying to POST this record: https://gist.github.com/dennybritz/f0c4a324b48239ab4cb8

I am getting a 42203 "Conversion of JSON to Avro failed" error. I'm new to Avro but I've spend several hours trying to debug this fiddling around with records and schema. I can't see what's going wrong. Any ideas?

Jun Rao

unread,
Mar 24, 2015, 11:11:42 AM3/24/15
to confluent...@googlegroups.com
Your JSON has to match Avro's JSON encoding, which has a few special rules (see http://avro.apache.org/docs/1.7.7/spec.html#json_encoding). In the case of union type, the JSON encoding need to include the type, unless the type is null.

So, instead of 

{
"url":"Text",
"title":"Text",
"authors":[],
"keywords":[],
"text":"Text",
"tags":[],
"publishDate": "",
"metaDescription":"",
"metadata":""
}

you will need sth like the following

{
"url":"Text",
"title":"Text",
"authors":[],
"keywords":[],
"text":"Text",
"tags":[],
"publishDate": {"string": ""},
"metaDescription": {"string": ""},
"metadata": {"string": ""}
}

Thanks,

Jun


--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/0e399e60-0f26-4812-87a6-ea0fe4b8b221%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denny

unread,
Mar 24, 2015, 8:56:02 PM3/24/15
to confluent...@googlegroups.com
Ah! Thank you Jun, I should have read that part more carefully.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages