Skip to content

Error reading JSON File  #2022

@Nirmal1313

Description

@Nirmal1313

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions