Replies: 3 comments 7 replies
-
Turned into an issue. Your question is likely too generic. I invite you to describe more precisely your application. It would make it easier for people to comment. |
Beta Was this translation helpful? Give feedback.
-
Please consider reading our paper and our documentation.
There is no "JSON object". Your deserialize the JSON into your own data structure... which you can then modify as you see fit. So you create your data structure like this... struct mydata {
int64_t key;
} Then you deserialize... mydata m;
m.key = i.get_uint64(); (If you have C++20, there is a more direct way to do this, please see our documentation.) And then you can modify the data as you see fit: m.key++; We deliberately do not create a DOM tree. We are currently working on automated serialization/deserialization to struct/classes. This will be possible with C++26: simdjson::padded_string json_str =
R"({"age": 12, "name": "John", "toys": ["car", "ball"]})"_padded;
simdjson::ondemand::parser parser;
simdjson::ondemand::document doc = parser.iterate(json_str);
kid k = doc.get<kid>();
std::string json = simdjson::builder::to_json_string(k);
std::cout << json << std::endl; In C++, currently, this is not possible at full speed in portable manner, but it will soon be. |
Beta Was this translation helpful? Give feedback.
-
The author of the question wants a conventional DOM tree. There are many good options out there for such applications. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to know,
Once the JSON content is being parsed from the file or std:: string.
How to make changes to the parsed JSON object?
This shouldn't modify the original JSON string.
dom or ondemand, whichever works.
Being able to edit is crucial for my app, without this, I won't be able to migrate my app to simdjson.
Beta Was this translation helpful? Give feedback.
All reactions