-
I wanted to create a JSON object which has a an array (
I would have believed that this object could have written created using the following script: std::ofstream writer("test.json");
json j, data;
data[1]["car"]["year"] = 2018;
data[1]["car"]["model"] = "a7";
data[1]["house"]["type"] = "semi";
data[1]["house"]["year"] = 2011;
j["members"] = data;
writer << std::setw(2) << j << std::endl; However, in the logged file I see a
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solved 🎉 It was pointed out that the |
Beta Was this translation helpful? Give feedback.
Solved 🎉
It was pointed out that the
null
is essentially the 0th element of the array. We can log arrays of objects by just ensuring that the array is 0-indexed.