Skip to content

deserialise from std::vector #667

Closed
Closed
@mlund

Description

@mlund

I'm trying to read into a vector, but run into the following problem:

#include <vector>
#include <json.hpp>
void from_json(const nlohmann::json &j, std::vector<int> &v) { /* something */ }
int main() {
    nlohmann::json j; 
    std::vector<int> v1 = j; // compiles
    std::vector<int> v2;
    v2 = j; // does not compile
}

Implementing as adl_serializer does not seem to work. Any help is greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions