goavro icon indicating copy to clipboard operation
goavro copied to clipboard

Support for ISO8601 JSON standard dates and datetimes

Open passuied opened this issue 2 years ago • 0 comments

The current Codec standard json addition (e.g. NewCodecForStandardJSONFull()) only seems to support long datetimes and int dates respectively...

When passing a date as ISO8601 (e.g. 2024-01-02T19:55:36.654287-08:00), it throws the following error:

could not decode any json data in input \"2024-01-02T19:55:36.654287-08:00\",\"flavor\":\"chocolate\"} for key: \"created_date\""}

Here are the steps to reproduce:

  • Schema: {"type": "record", "name": "cupcake", "fields": [{"name": "flavor", "type": "string"}, {"name": "created_date", "type": ["null",{"type": "long","logicalType": "timestamp-millis"}],"default": null}]}
  • JSON: "{"created_date":"2024-01-02T19:55:36.654287-08:00","flavor":"chocolate"}"

passuied avatar Jan 03 '24 04:01 passuied