-1

I have a json object having data as :

[
    {
        "help": "Required ARIA attributes must be provided",
        "nodes": [
            {
                "all": [],
                "impact": "critical",
                "html": "<input id=\"chkPrvt\" onclick=\"clkSec()\" name=\"trusted\" value=\"4\" type=\"checkbox\" class=\"chk\" role=\"checkbox\" aria-labelledby=\"privateLabel\">",
                "none": [],
                "any": [
                    {
                        "data": [
                            "aria-checked"
                        ],
                        "impact": "critical",
                        "relatedNodes": [],
                        "id": "aria-required-attr",
                        "message": "Required ARIA attribute not present: aria-checked"
                    }
                ],
                "target": [
                    "#chkPrvt"
                ]
            },
            {
                "all": [],
                "impact": "critical",
                "html": "<input id=\"chkBsc\" type=\"checkbox\" onclick=\"clkBsc();\" class=\"chk\" role=\"checkbox\" aria-labelledby=\"lightLabel\">",
                "none": [],
                "any": [
                    {
                        "data": [
                            "aria-checked"
                        ],
                        "impact": "critical",
                        "relatedNodes": [],
                        "id": "aria-required-attr",
                        "message": "Required ARIA attribute not present: aria-checked"
                    }
                ],
                "target": [
                    "#chkBsc"
                ]
            }
        ],
        "impact": "critical",
        "description": "Ensures elements with ARIA roles have all required ARIA attributes",
        "helpUrl": "https://dequeuniversity.com/rules/axe/2.1/aria-required-attr?application=axeAPI",
        "id": "aria-required-attr",
        "tags": [
            "wcag2a",
            "wcag411",
            "wcag412"
        ]
    }
]

I want to convert JSON data into a HTML table using Javascript or Java. Can someone suggest a way how to do that?.

Any advise on this would be helpful. Thanks in advance

syndy1989
  • 403
  • 10
  • 25

1 Answers1

0

I would recommend that you read about JavaScript nodes and creating new HTML elements from JavaScript. When you know the basics you can go through your object and create new rows and columns and add them to the page.

Take a look at this link : HTML Nodes from W3Schools

Also I belive this question has already be asked: Older question

Community
  • 1
  • 1
mbelmin
  • 113
  • 1
  • 6