How to represent this table structure using JSON?

2

New to JSON, wold like your advice:
What is the best way to represent this table structure using JSON
enter image description here

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

JavaSheriff

Posted 2017-07-02T01:32:30.547

Reputation: 150

1Would be REALLY helpful if you provide this as text/spreadsheet/csv, and NOT an image. It's difficult to help you, when someone has to type out all that text! – jehad – 2017-07-02T01:51:11.777

Answers

2

There are different options for representing data in JSON (or any format).

Here is an example of one way I would choose to represent the data in the originally posted question:

{   "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"}}]
}

(It's mostly abbreviated, because I wrote this based on the data provided as an image, and I did not want to transcribe everything. Hopefully, you get the idea.)

...

And, this is the exact same JSON (except text is now copied from the updated question), but prettified and validated, using more standard white space formatting:

{
    "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"
        }
    }]
}

jehad

Posted 2017-07-02T01:32:30.547

Reputation: 1 376