Skip to content

Construction in a member initializer list using curly braces is set as 'array' #1742

Closed
@kyeonghopark

Description

  • What is the issue you have?
    The type of json object is set as 'array' in a constructor of an inherited class.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

class child : public nlohmann::json {
 public:
  explicit child(const nlohmann::json &j) : nlohmann::json{j} {}
};

nlohmann::json j = nlohmann::json::parse("{\"a\":1}");
child c{j};

  • What is the expected behavior?
    The type of c should be 'object', not 'array'.

  • And what is the actual behavior instead?
    The type of c is 'array'.

  • Which compiler and operating system are you using? Is it a supported compiler?
    Visual Studio 2019 (v142)

  • Did you use a released version of the library or the version from the develop branch?
    A released version 3.7.0

  • If you experience a compilation error: can you compile and run the unit tests?
    This is not a compilation error.

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