Skip to content

Add array support for update() function #1751

@mrakh

Description

@mrakh

I think it would be nice to add functionality to the update() function that allows one to update an array's contents with an object that has integer keys, like so:

nlohmann::json myarr = { 5, 4, 3, 2, 1 };
myarr.update({ { "1", 40 }, { "4", 10 } });
std::cout << myarr.dump() << std::endl;
// Should output [5,40,3,2,10]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: enhancement/improvementstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions