如何使用JSON表示这个表结构?

如何使用JSON表示这个表结构?

对 JSON 不熟悉,希望得到您的建议:
使用 JSON 表示此表结构的最佳方法是什么
在此处输入图片描述

Physical check
    Check existing printer      checked INSPECTOR REMARKS HERE
Printer visual check
     Check front of printer checked INSPECTOR REMARKS HERE
    Check ink levels        checked INSPECTOR REMARKS HERE
    Check led lights        checked INSPECTOR REMARKS HERE
    Check power cord        checked INSPECTOR REMARKS HERE
    Check print quality     checked INSPECTOR REMARKS HERE
    Check paper size        checked INSPECTOR REMARKS HERE
    Check paper amount      not checked INSPECTOR REMARKS HERE
Covers test 
    Front cover test  checked INSPECTOR REMARKS HERE
Operative check             
    [blank] checked INSPECTOR REMARKS HERE

答案1

有不同的选项来表示 JSON(或任何格式)中的数据。

下面是我选择在最初发布的问题中表示数据的一种方法的示例:

{   "PHC": [{"CEP": {"Status": "Done", "Notes": "Inspector remarks here"}}],

    "PVC": [{"CFP": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CIL": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CLL": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CPC": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CPQ": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CPS": {"Status": "Done", "Notes": "Inspector remarks here"},
             "CPA": {"Status": "Done", "Notes": "Inspector remarks here"}}],

    "CovTest": [{"FrontCT": {"Status": "Done", "Notes": "Inspector remarks here"}}],

    "OpCheck": [{"": {"Status": "Done", "Notes": "Inspector remarks here"}}]
}

(它大部分都是缩写,因为我是根据以图像形式提供的数据编写的,并且我不想转录所有内容。希望你能明白我的意思。)

...

而且,这是完全相同的 JSON(除了文本现在是从更新的问题中复制的),但经过了美化和验证,使用了更标准的空白格式:

{
    "Physical check": [{
        "Check existing printer": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        }
    }],

    "Printer visual check": [{
        "Check front of printer": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check ink levels": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check led lights": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check power cord": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check print quality": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check paper size": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        },
        "Check paper amount": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        }
    }],

    "Covers test": [{
        "Front cover test": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        }
    }],

    "Operative check": [{
        "": {
            "Status": "checked",
            "Notes": "Inspector remarks here"
        }
    }]
}

相关内容