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

JSON stream parser/serializer #281

Open
tshemsedinov opened this issue Jan 29, 2025 · 2 comments
Open

JSON stream parser/serializer #281

tshemsedinov opened this issue Jan 29, 2025 · 2 comments

Comments

@tshemsedinov
Copy link
Member

const items = Array.from(
  { length: 100 },
  () => ({
    message: 'hello world from consumers!',
  }),
);
const json = JSON.stringify(items);
const readable = JSONReadable.from(json);
for await (const item of items) {
  console.log(`from readable: ${data.length}`);
});
  • Select parsing mode by first symbol: '{' or '['
  • '{' will generate single chunk
  • '[' will generate multiple single chunks by array elements
  • Example: receiver [{"name":"Marcus"},{"name":"Luci ... next chunk us",{"name":"Commodus"}]
    • will generate 1st event: {"name":"Marcus"} and save rest in buffer {"name":"Luci
    • after receiving next chink will generate 2nd event: {"name":"Lucius"} and {"name":"Commodus"}
@leonid-shutov
Copy link
Contributor

I would like to work on this one

@artem-ye
Copy link

artem-ye commented Feb 6, 2025

Hi, i did some research
https://github.com/artem-ye/JSONReader/tree/master
Would like to work on this task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants