-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Question: How to erase subtree #622
Labels
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Comments
The erase function can do this: #include "json.hpp"
using json = nlohmann::json;
int main()
{
json j = R"({
"S2_hard": {
"low": 16007169,
"percent": 6.32297670017418,
"s2_hard": "41872228438534",
"seconds": 1.66252099978738,
"segment_size": 131072,
"segments": 24,
"thread0": {
"low": 9715713,
"segment_size": 131072,
"segments": 24
},
"thread1": {
"low": 12861441,
"segment_size": 131072,
"segments": 24
},
"x": "100000000000000000",
"y": 10990372,
"z": 9098873086
}
})"_json;
// remove key "thread1"
j["S2_hard"].erase("thread1");
std::cout << std::setw(2) << j << std::endl;
} |
nlohmann
added
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
labels
Jun 17, 2017
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Hi,
Thanks for your awesome library! I use it in my primecount project.
I would like to erase a subelement/subtree, e.g. in the example below I would like to erase
["S2_hard"]["thread1"]
. Note that"thread1"
may also exist in other subtrees e.g.["S2_easy"]["thread1"]
which should not be erased.How can I achieve this?
The text was updated successfully, but these errors were encountered: