-
Hello, does this library provide a way to deserialize vectors from a JSON file? What I mean is if I have something like this in a json file {
"v": {3, 2, 3}
} Then I'm trying to do this: std::ifstream i("pathtojsonfile");
json j;
i >> j;
vector<int> v = j["test"] But this isn't working. So how then do I do it? I looked through the docs carefully but don't see anything about deserializing into a vector, rather I only see stuff about serializing. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
nlohmann
Nov 6, 2020
Replies: 1 comment
-
The example above is not valid JSON. It should be {
"v": [3, 2, 3]
} Then you can access the array with |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nlohmann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example above is not valid JSON. It should be
Then you can access the array with
j["v"]
.