Question

need help in json to html conversion

Posted August 6, 2021 143 views
PHPJavaScriptHTML

hello all community developers,

what i need i want to convert specifically format json to html:

and format is:

{
      "document": {
        "@pageCount": "1",
        "@pageCountWithOCRPerformed": "0",
        "page": {
          "@index": "0",
          "@OCRWasPerformed": "False",
          "row": [
            {
              "column": [
                {
                  "text": ""
                },
                {
                  "text": ""
                },
                {
                  "text": ""
                },
                {
                  "text": {
                    "@fontName": "Helvetica",
                    "@fontSize": "24.0",
                    "@fontStyle": "Bold",
                    "@color": "#FFFFFF",
                    "@x": "1578.85",
                    "@y": "981.08",
                    "@width": "24.54",
                    "@height": "12.07",
                    "#text": "1"
                  }
                },......

please guide me it is urgent

thanks

edited by KFSys

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @assh1984,

I recommend using PHP to convert JSON to HTML.

PHP has some built-in functions to handle JSON.

Objects in PHP can be converted into JSON by using the PHP function jsonencode(): With that being said, you can decode JSON data into PHP Arrays which will then be parsed to HTML with jsondecode();.

Once you do with a foreach loop can loop the data and print it as HTML.