Node.js 如何通过nodejs清理和编辑JSON文件

Node.js 如何通过nodejs清理和编辑JSON文件,node.js,json,Node.js,Json,我有一个JSON文件,其中包含一些需要删除的数据: { "Count": 2, "Items": [ { "character": { "S": "1234" }, "location": { "S": "east" }, "inputs": {

我有一个JSON文件,其中包含一些需要删除的数据:

{
    "Count": 2, 
    "Items": [
        {
            "character": {
                "S": "1234"
            }, 
            "location": {
                "S": "east"
            }, 
            "inputs": {
                "S": "1"
            }, 
            "region": {
                "S": "north"
            }, 
            "access": {
                "S": "0"
            }  "S": "physical"
        }
    ], 
    "ScannedCount": 2, 
    "ConsumedCapacity": null
}

我要删除的是项目[]括号之外的所有内容

我发现这是可行的。感谢@Zero298的最初想法

var fs = require('fs');
var newJSON = '';
newJSON = JSON.stringify(JSON.parse(fs.readFileSync('my_file.json', 'utf8'))['Items'], null, 4);
console.log("THIS IS THE NEW JSON");
console.log(newJSON);
JSON.stringify(JSON.parse(您的_文件)[“Items”],null,4)
只返回“Items”。我正在尝试获取项目中的数组