avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Kreps <jay.kr...@gmail.com>
Subject GenericRecord.toString does not handle enums properly
Date Wed, 15 Dec 2010 21:13:37 GMT
The output from GenericRecord.toString in Java is not valid JSON, for
example a record with the schema:

{
  "type": "record",
  "name": "TestRecord",
  "fields" : [
    {"name":"enum_field",
     "type":{"type":"enum",
                 "symbols":["a", "b"],
                 "name":"MyEnumType"}},
  ]
}

Should be output as
{"enum_field":"a"}
but is output as
{"emum_field":a}

The later is not really JSON. I saw this on 1.4 but I think it exists
on trunk too.

Is this a known issue? I think the fix is just to add another special
case in GenericData.toString()...

-Jay

Mime
View raw message