Skip to content
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

Error reading JSON File #2022

Closed
Nirmal1313 opened this issue Apr 1, 2020 · 0 comments
Closed

Error reading JSON File #2022

Nirmal1313 opened this issue Apr 1, 2020 · 0 comments

Comments

@Nirmal1313
Copy link

Nirmal1313 commented Apr 1, 2020

hi,
i am quite new in reading json file in c++.

So my file json file is

   "Image_Details": {
    "Image": {
      "ImagePath": "/home/.../super.png",
      "Filetype": ".jpg,.png",
      "ImageResolution": {
        "Obj_Height": 1000,
        "Obj_Width": 800
      },
      "ImagePosition": {
        "Pos-X-coordinates_start(Width)": 0,
        "Pos-Y-coordinates_start(Height)": 0,
        "Pos-z-coordinates_start": 0
      }
   }
}

in c++ my code is

superdata = nlohmann::json::parse(superDetails);
std::cout << std::setw(4) << superdata << "\n\n";
 auto s2 = superdata["Image_Details"]["ImageResolution"]["Obj_Height"];

output of s2 is null.
how can read indivual value of my JSON file such as obj_width in ImageResolution object?
any idea how can read it or get the value ?

regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant