Skip to content

[json.exception.type_error.304] cannot use at() with object #902

@aprowe

Description

@aprowe

Hi, I am getting

[json.exception.type_error.304] cannot use at() with object

Which doesn't make sense to me, since I figured thats what at() is for.
What does this error mean? Printing my json object it seems to look like a normal json string.

Code:

  std::stringstream ss;

  // msgpack object
  ss << obj;

  std::cout << ss.str();
  // {"subject":"set_detection_mapping_mode", "mode":"3d"}

  std::string str;
  try {
    auto j = json::parse(ss.str().c_str());
    str = j.at('subject').get<std::string>();

  } catch (detail::type_error &e) {
    std::cout << e.what();
    // [json.exception.type_error.304] cannot use at() with object
  }

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions