如何从API指定特定数据?

到目前为止,我一直在尝试从Steam API提取特定数据,我已经能够过滤结果,这是一个示例;

https://store.steampowered.com/api/appdetails?appids=218620&filters=metacritic

哪个给我;

{"218620":
  {"success":true,"data":
     {"metacritic": 
       {"score":79,"url":"https:\/\/www.metacritic.com\/game\/pc\/payday-2?ftag=MCD-06-10aaa1f"}
     }
  }
}

但是,我想要的只是数字分数,因此在这种情况下,它只会显示'79'。

我正在使用iframe呈现数据,这就是为什么它需要调用特定值的原因。如果有人对我该如何做有任何建议,或者提供了另一种解析数据的方法。

我的编码能力有限,因此这似乎是一个基本问题,或者是预先提取如此道歉的数据的基本方法。如果有帮助,我还将代码添加到基于PHP的Shopify中。

我知道https://steamspy.com/api.php有自己的API,该API提供相似的数据,从那里而不是直接从Steam商店收集数据会更容易吗?

yujingjean 回答:如何从API指定特定数据?

您获得的数据在JSON format中。 JSON旨在简化数据访问。

您未指定编程语言,并且我没有shopify的经验。所以这里是Java语言。试试这个JSFiddle

public class MainDivert {

    public static void main(String[] args) throws Exception {
        try {
            MainApp.main(args);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
}
本文链接:https://www.f2er.com/3129036.html

大家都在问