-
-
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
Provide an example of reading from an json with only a key that has an array of strings. #354
Comments
How about this: #include <fstream>
#include <iostream>
#include "json.hpp"
using namespace nlohmann;
int main() {
std::ifstream in("./test.json");
json file = json::parse(in);
try {
auto& array = file.at("detectlist");
for (auto&& val: array) {
std::cout << val << std::endl;
}
} catch(std::exception&) {
std::cout << "no luck" << std::endl;
}
} |
ok, now that works but all I have to do is now take the value for each one and convert it to a |
Can this ticket be closed? |
I'd say yes |
@AraHaan You can get a From there follow the usual conversions. I close the ticket, because the original question has been answered. If you need further help, please let me know. |
So, I have a json that is somewhat like this:
What I want to do is iterate through that list and with each string in it I want to use the
FindWindow
function fromkernel32.dll
to check if a window with a string in the list is open or not.Here is how I would like the strings to look like if output to a console (with new lines after each one):
Any idea what I can do to anchieve this? I have the following code so far:
The text was updated successfully, but these errors were encountered: