我正在尝试解析 JSON。下面的例子,
[
{
"id": "(error)",
"raw": "Expected an assignment or function call and instead saw an expression.",
"code": "W030",
"evidence": "v",
"line": 1,
"character": 1,
"scope": "(main)",
"reason": "Expected an assignment or function call and instead saw an expression."
},
{
"id": "(error)",
"raw": "Missing semicolon.",
"code": "W033",
"evidence": "v",
"line": 1,
"character": 2,
"scope": "(main)",
"reason": "Missing semicolon."
}
]
我只需要打印如下内容:
- 原因 1:期望一个赋值或函数调用,而是看到一个表达式。
- 原因 2:缺少分号。
我有一个演示。我怎样才能只解析“原因”属性/值以及它发生了多少次?