This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Refactored JSON IO (better support for JSON and NDJSON) #870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors APIs to read and write to JSON and NDJSON.
Currently, writing a primitive array to JSON requires writing a list of objects (e.g.
[{"a": 1}, {"a": null}]
). However, JSON supports simpler representations of a primitive array,[1, null]
.The same holds true for NDJSON, where we required the user to write
This PR removes this, allowing users to write
[1, null]
and1\nnull
respectively. The previous behavior is now a particular case, viaStructArray
.The APIs of json and ndjson were also separated in two distinct modules since they are sufficiently different formats. All the public API changes are shown in the changes to the examples, and the guide was updated accordingly.