Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在JSON中查找字段_Json - Fatal编程技术网

如何在JSON中查找字段

如何在JSON中查找字段,json,Json,这是我的json脚本。。我需要找到“项目”和标题和作者字段及其值。我在python中使用参考系统.net.json。 // JSON { "items": [ { "title": "welcoem home", "author": "Charles Dickens" }, { "title": "Harry Potter", "author": "J rowling" }] } 发帖前你修改了你的问题吗?你确定你能理解自己的问题吗?请编辑您的问

这是我的json脚本。。我需要找到“项目”和标题和作者字段及其值。我在python中使用参考系统.net.json。

// JSON
{
"items": [
  {
    "title": "welcoem home",
    "author": "Charles Dickens"
  },
  {
    "title": "Harry Potter",
    "author": "J rowling"
  }]
}

发帖前你修改了你的问题吗?你确定你能理解自己的问题吗?请编辑您的问题并解释您需要什么。。。别忘了告诉我们你用的是什么语言。看起来你好像看到了一些json波(问题之间的差异不到1小时)我还找不到任何解决方案。我需要dotnet的代码。我需要先找到“物品”。如果(“项”),则仅在其中查找文件和值。
data = """
{ "items": [ { "title": "welcoem home", "author": "Charles Dickens" }, { "title": "Harry Potter", "author": "J rowling" }] }
"""

import json
data2 = json.loads(data)
authors = [x['author'] for x in data2['items']]