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

Avoid using map collections in the json output #208

Closed
Tracked by #173
hectorj2f opened this issue May 10, 2024 · 5 comments · Fixed by #228
Closed
Tracked by #173

Avoid using map collections in the json output #208

hectorj2f opened this issue May 10, 2024 · 5 comments · Fixed by #228
Assignees
Labels
enhancement New feature or request

Comments

@hectorj2f
Copy link

Map collections are not part of the JSON standard compliant. It'd be great to change the json output to use json objects instead of map collections.

@hectorj2f hectorj2f self-assigned this May 10, 2024
@tstromberg
Copy link
Collaborator

TIL that Go's JSON encoder is able to generate non-compliant JSON :(

@hectorj2f
Copy link
Author

Wouldn't it be possible for us to change the FileReport struct to use an array of Behavior instead of a map[string]Behavior ? I am trying to use the JSON output to store it in BigQuery. But the map collection isn't supported so I have to convert/iterate over all the bincapz results :/.

@jonjohnsonjr
Copy link
Contributor

Map collections are not part of the JSON standard compliant. It'd be great to change the json output to use json objects instead of map collections.

Can you explain this? I don't believe you.

@hectorj2f
Copy link
Author

Although map-like structures can be represented using JSON, because they don't require a schema. Applications can use a "schema-on-read" approach, where the application ingests the data and then queries based on assumptions about a schema. Regarding map-like structures, the JSON schema doesn't explicitly recommend or provide built-in support for them, that is why is sometimes recommended to construct instead JSON objects that reassemble like map collections. By following this, you sometimes avoid flattening the JSON structure out when they are represented as map collections.

When I referred to JSON compliant I meant that certain processing services sometimes have limitations when it comes to handle complex structures (map collections or dynamic schemas) in JSON.

@tstromberg
Copy link
Collaborator

Wouldn't it be possible for us to change the FileReport struct to use an array of Behavior instead of a map[string]Behavior ?

Sure - I'm open to that. PR's welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants