Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialize avro messages to JSON and preserve field order #209

Open
weeco opened this issue Nov 24, 2022 · 3 comments
Open

Deserialize avro messages to JSON and preserve field order #209

weeco opened this issue Nov 24, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@weeco
Copy link

weeco commented Nov 24, 2022

Hey,
is it possible to deserialize an avro message to a JSON / text format which also preserves the order of the fields as defined in the avro schema? Currently I unmarshal the avro message to an interface{} and then I apply json.Unmarshal() on it which works fine, but the fields are ordered alphabetically rather than in the order as defined in the schema.

@nrwiersma
Copy link
Member

Hi,

No. This repo does not handle the text representation at all, it is entirely focused on the binary representation.

@weeco
Copy link
Author

weeco commented Nov 24, 2022

@nrwiersma Thanks for the speedy response. Would you accept PRs for such a method that or is this something you don't want to have as part of this library. Unfortunately I don't see a workaround, because the field order information is lost after the unmarshal process I believe.

@nrwiersma
Copy link
Member

I would accept PRs for this feature, but I would put it in a json package to not pollute the main codebase.

@nrwiersma nrwiersma added enhancement New feature or request help wanted Extra attention is needed labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

2 participants