simdjson icon indicating copy to clipboard operation
simdjson copied to clipboard

Support for building json?

Open Dariusz1989 opened this issue 4 years ago • 4 comments

Hey

1st of all, thanks for the one file h/cpp lib & basic docs, love it! Great read/easy to use.

Its not much of an issue as more of a question... but can simdjson actually create jsons from "scratch" that then I could get raw string from/serialize etc etc?

Say

dom::element item;
item["val"]=312312;
item[10]="312312;
item["data"] = dom::element();
item["data"]["someData"]="wow";

etc,etc ? Or is simdjson only used to read json's and not create them for usage/etc?

Regards Dariusz

Dariusz1989 avatar Apr 27 '20 19:04 Dariusz1989

The DOM tree in simdjson is immutable. Thus simdjson cannot really be used for serialization... building DOM and writing out JSON.

Up until simdjson 1.0, it is considered a non-goal to be able to use simdjson for building JSON trees, see https://github.com/simdjson/simdjson/issues/503

We may revisit this after release 1.0, but it is basically in the far future for us.

Of course, if brave folks want to contribute, that could change the direction.

lemire avatar Apr 27 '20 20:04 lemire

Hey

I see, so its very fast reader and for writing, I need to use a different library o.O

This is going to be fun :- )

Thank you!

Dariusz1989 avatar Apr 27 '20 20:04 Dariusz1989

Yeah, fast writing is something we think about, but we kinda want to get it right. There are some things we want to understand about the read scenario before we go there.

But as noted, contributions are absolutely accepted :)

jkeiser avatar Apr 27 '20 21:04 jkeiser

I jumped right into this project thinking it could do writing. So +1 for supporting this.

dan-ryan avatar Dec 10 '20 01:12 dan-ryan