Closed
Description
Hello!
I've noticed that this is a recurring issue and have been looking thought closed and open issues for any solutions, but for some reason getting a vector containing a custom type from json throws "[json.exception.type_error.302] type must be array, but is null" which is based on exception.what()'s output.
I have this JSON file:
[ { "date":"20200116", "id":1589, "path":"D:\\_projects\\ChickenIdentifier\\P3-1589_L_20200116.jpg", "penName":"P3", "side":76 }, { "date":"20200116", "id":1589, "path":"D:\\_projects\\ChickenIdentifier\\P3-1589_R_20200116.jpg", "penName":"P3", "side":82 }, { "date":"20200116", "id":1592, "path":"D:\\_projects\\ChickenIdentifier\\P3-1592_L_20200116.jpg", "penName":"P3", "side":76 }, { "date":"20200116", "id":1592, "path":"D:\\_projects\\ChickenIdentifier\\P3-1592_R_20200116.jpg", "penName":"P3", "side":82 } ]
What I've tried:
auto vec = j.get<std::vector<PictureInfo>>();
<-- Produces the same errorj.at("varName").get_to<std::vector<PictureInfo>>(c.required);
<-- Dont think I can use since list doesnt have a name/key.-
auto pics = j.get>(); //<-- Produces the same error
std::vector pics = (std::vector) pics;
Im using Win10 and MS Visual Studio Community 2019
Lib version: "JSON for Modern C++ version 3.7.3"
Appreciate any help and please let me know if anything else is needed