小编use*_*633的帖子

如何通过d语言阅读tweeter json

我有一个tweeter json(保存在一个名为latest.json的文件中),我解析为"jasonvalue doc",我尝试读取它并打印特定数据.下面的代码每次打印相同的数据,而不是数据形成整个json.

auto content = to!string(read("latest.json"));
 JSONValue doc = parseJSON(content).object; 
 while (i<3){
    writeln(doc.object["created_at"].str,"\n");
    writeln(doc.object["text"].str,"\n");
    writeln(doc.object["retweet_count"].integer,"\n");
    i++;
 }
Run Code Online (Sandbox Code Playgroud)

我怎么能读到所有的杰森?

json d

2
推荐指数
1
解决办法
580
查看次数

标签 统计

d ×1

json ×1