Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81802

How to parse this nested json

$
0
0

Hi,
I am working on displaying json data in DataTable.
My json looks like this.

    "Results": [
        {
            "DocId": "4842-1398-5949",
            "EnvId": ":Q21:k:p:o:7:~190718162425318.nev|1",
            "DocNum": 1,
            "CustomAttributes": [
                {
                    "Id": 1001,
                    "Value": [
                        "OGC - Admin"
                    ]
                },
                {
                    "Id": 1005,
                    "Value": [
                        "Watch List Project Tracking"
                    ]
                },
                {
                    "Id": 1003,
                    "Value": [
                        "AVR"
                    ]
                },
                {
                    "Id": 1004,
                    "Value": [
                        "Watch List FY20"
                    ]
                },
                {
                    "Id": 6,
                    "Value": [
                        "My Name 1"
                    ]
                },
                {
                    "Id": 5,
                    "Value": [
                        "2019-07-18 20:24:25Z"
                    ]
                },
                {
                    "Id": 8,
                    "Value": [
                        "My Name 1"
                    ]
                },
                {
                    "Id": 7,
                    "Value": [
                        "2020-02-13 20:43:57Z"
                    ]
                },
                {
                    "Id": 11,
                    "Value": [
                        "xlsx"
                    ]
                }
            ]
        },
        {
            "DocId": "4819-9709-4576",
            "EnvId": ":Q19:c:1:j:d:~200109120634702.nev|1",
            "DocNum": 1,
            "CustomAttributes": [
                {
                    "Id": 1001,
                    "Value": [
                        "Research Office"
                    ]
                },
                {
                    "Id": 1005,
                    "Value": [
                        "NIH Inquiry - Sotomayor"
                    ]
                },
                {
                    "Id": 1003,
                    "Value": [
                        "CJO"
                    ]
                },
                {
                    "Id": 1002,
                    "Value": [
                        "Chart/Spreadsheet"
                    ]
                },
                {
                    "Id": 6,
                    "Value": [
                        "My Name 2"
                    ]
                },
                {
                    "Id": 5,
                    "Value": [
                        "2020-01-09 17:06:34Z"
                    ]
                },
                {
                    "Id": 8,
                    "Value": [
                        "My Name 2"
                    ]
                },
                {
                    "Id": 7,
                    "Value": [
                        "2020-02-13 20:28:40Z"
                    ]
                },
                {
                    "Id": 11,
                    "Value": [
                        "docx"
                    ]
                }
            ]
        }
]

I have to display data in CustomAttributes.
Each ID value correspond to a title (which will be table column names) and value will be column value.
I have a list of 11 ids and the result json will have data for any of those 11 ids.
Any pointer on how to go about setting up the table will be really helpful.


Viewing all articles
Browse latest Browse all 81802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>