Add support streaming json parsing from array of objects
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 681
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
The problem: there is a massive array of objects, and it is very, very large, I want to be able to parse this array in parts, object-wise.
```ts
new Response(`[{}, {}, {},\n{},\t{}...]`)
// transform
transformed = ...
for await (const line of transformed) {
const obj = JSON.parse(line)
}
````
**Describe the solution you'd like**
Add transformer that supports top level array or array by path (Eg: `{data: [{}, {}, {}]}`
Good: https://pkg.go.dev/encoding/json#Decoder, https://pkg.go.dev/encoding/json#example-Decoder.Decode-Stream
**Describe alternatives you've considered**
The npm ecosystem is full of solutions that are very poorly made or just very slow and resource intensive
Contributor guide
Assessment
This issue has not been assessed yet.