[
https://issues.apache.org/jira/browse/AVRO-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jay Kreps updated AVRO-713:
---------------------------
Attachment: avro-tostring-json-fix.diff
Here is a patch that fixes the enum issue. It also includes proper escaping of
JSON strings (i.e. so if the string contains a quote the json string isn't
prematurely terminated. The escaping code is adapted from
http://code.google.com/p/json-simple/source/browse/trunk/src/org/json/simple/JSONValue.java#227.
Copying the escaping code to write directly to the StringBuilder seems better
than using Jackson, since I think with Jackson we would have to instantiate a
bunch of objects and double-copy the string.
> GenericRecord.toString can produce invalid JSON
> -----------------------------------------------
>
> Key: AVRO-713
> URL: https://issues.apache.org/jira/browse/AVRO-713
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.4.1
> Reporter: Jay Kreps
> Attachments: avro-tostring-json-fix.diff
>
>
> The GenericData.toString method can produce invalid JSON. The problem is that
> enums are printed without quotes, as in
> {"emum_field":a}
> instead of
> {"enum_field":"a"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.