-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
find is error #32
Labels
solution: invalid
the issue is not related to the library
Comments
I'll check tonight. |
I do not really understand your problem. I tried the following code: json jsonData = {{"Heart_COL", "DF01140234340000"}};
auto it = jsonData.find("type");
//std::cout << *it << '\n'; will throw, because it == json.end()
it = jsonData.find("Heart_COL");
std::cout << *it << '\n'; // prints "DF01140234340000"
std::cout << it.key() << '\n'; // prints Heart_COL
std::cout << it.value() << '\n'; // prints "DF01140234340000"
std::cout << it->get<std::string>() << '\n'; // prints DF01140234340000 What did you try to achieve in your code? What went wrong? |
@lonerwolf, could you please comment? |
I close this issue until the problem is clear. |
GerHobbelt
pushed a commit
to GerHobbelt/nlohmann-json
that referenced
this issue
May 7, 2021
Sync Fork from Upstream Repo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
json o;
o["foo"] = 23;
o["bar"] = false;
o["baz"] = 3.141;
// find an entry
if (o.find("foo") != o.end()) {
// there is an entry with key "foo"
}
in my example
key:"Heart_COL"
type:"HEX"
val:"DF01140234340000"
auto it = jsonData.find("type");
std::cout << *it << '\n';
the printf data is "Heart_COL"
The text was updated successfully, but these errors were encountered: