https://github.com/nlohmann/jsonを使用してJSON ファイルをプログラムにロードしています。
現時点では、私はそれをロードしています:
json jsonFile;
ifstream ifs("data/test.json");
ifs >> jsonFile;
// create JSON from stream
json j_complete(jsonFile);
そして、私は次の方法でアクセスできます:
jsonFile["data"][X][Y] // X, Y are indexes
しかし、これからベクトルを作成したいのですが、どうすればよいですか?
このファイルのサンプルは次のとおりです。
{
"cols": [
"id",
"title",
"quantity",
"price"
],
"data": [
[
12,
"Guzman",
6,
"6.31"
],
[
2,
"..",
5,
"4.34"
],
[
3,
"Goldeniererere",
14,
"4.15"
]
]
}