1
JSON 형식의 교육 데이터가 포함 된 Yummly Data을로드하려고합니다. 여기에 단일 레코드의 샘플입니다Chapel에서 가변 길이 JSON 배열을로드하는 방법은 무엇입니까?
{
"id": 10259,
"cuisine": "greek",
"ingredients": [
"romaine lettuce",
"black olives",
"grape tomatoes",
"garlic",
"pepper",
"purple onion",
"seasoning",
"garbanzo beans",
"feta cheese crumbles"
]
}
그리고 여기이 데이터
를로드하는 나의 시도는use IO;
const test_data_f: string = "/home/buddha314/datasets/yummly/test.json",
train_data_f:string = "single_recipe.json";
writeln("let's load some json, shall we?");
record Recipe {
var cuisine: string,
id: int,
ingredients: [1..1] string;
}
var f = open(train_data_f, iomode.r);
var r = f.reader();
var final : Recipe;
r.readf("%jt\n", final);
writeln(final);
나는 분명히 성분 사전의 수를 알 수 없습니다, 그래서 라인을 시도 ingredients: [1..1] string;
는 사용할 수 없습니다. 그걸로 어지러운 후에, 나는 그것을 작동시키지 못했습니다. 는 '목록'을 사용