Display object with array inside

Display object with array inside

asingh18asingh18 Posts: 4Questions: 2Answers: 0

I have the follow JSON response

{draw: 1, recordsTotal: 17, recordsFiltered: 17,…}
data: [{appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…},…]
0: {appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…}
1: {appName: "SharePoint (ARD)",…}
2: {appName: "SharePoint (ARD)",…}
appName: "SharePoint (ARD) "
contactsRoles: [{key: "N1", value: "SpOwner1"}, {key: "N2", value: "SpOwner1"},…]
ministry: "Ministry"
serversUrls: {S1: ["URL"], S2: ["URL"]}
S1: ["URL"]
S2: ["URL"]
zone: "ZONE"
draw: 1
recordsFiltered: 17
recordsTotal: 17

I am trying to display the serversUrls portion but am running into issues.

Jquery Code

<script type="text/javascript" >
         $('#result').DataTable({
            "serverSide":true,
            "filter": false,
            "orderMulti": false,
            "pageLength": 50,     //Set default page length to 50
            "targets": 'no-sort', //Removes the sorting arrows
            "bSort":false,        //Removes the sorting arrows
            "ajax": "DetailedSearch?handler=ServerSideDataTable",
            "columns":[
                {"data": "location","title":"location"},
                {"data": "serversUrls", "sortable": "false","title":"Servers",
                 "render": function(data,type,row){
                     return data;
                 }
                }
            ],
             rowGroup:{
                dataSrc:'appName'
            },

        });
</script>

If i display the data by using only {"data": "serversUrls", "sortable": "false","title":"Servers"} i get [object Object] as an output

Ive tried using the render function function that returns data, and im met with the same result.

How can i display this type? Im sending a Dictionary<string,List<string>> to the front-end

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @asingh18 ,

    Your data has been truncated, so hard to read. Could you post it 'as is', please, or better still, link to your page.

    Cheers,

    Colin

  • asingh18asingh18 Posts: 4Questions: 2Answers: 0

    Thanks for the reply Colin,

    I cant link the page as its only accessible internally, If by truncated you mean the contactsRoles portion that is already working...Or do you want me to expand the other applications? Also i have removed some sensitive information replacing with things like S1 etc

This discussion has been closed.