Using complex JSON
Using complex JSON
 alexHuber            
            
                Posts: 2Questions: 1Answers: 0
alexHuber            
            
                Posts: 2Questions: 1Answers: 0            
            Hi there,
I have a rather complex JSON, which I would like like to use to build my datatable.
Table columns:  "ID", "Title", "FullName", "Company", "JobTitle"
Any suggestions how to achieve that?
Thanks, Alex
JSON
{  
   "d":{  
      "results":[  
         {  
            "__metadata":{  
               "id":"a831a43f-85d6-4eca-b1b2-76615133b7c0",
               "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)",
               "etag":"\"1\"",
               "type":"SP.Data.ContactsListItem"
            },
            "FirstUniqueAncestorSecurableObject":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/FirstUniqueAncestorSecurableObject"
               }
            },
            "RoleAssignments":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/RoleAssignments"
               }
            },
            "AttachmentFiles":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/AttachmentFiles"
               }
            },
            "ContentType":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/ContentType"
               }
            },
            "FieldValuesAsHtml":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/FieldValuesAsHtml"
               }
            },
            "FieldValuesAsText":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/FieldValuesAsText"
               }
            },
            "FieldValuesForEdit":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/FieldValuesForEdit"
               }
            },
            "File":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/File"
               }
            },
            "Folder":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/Folder"
               }
            },
            "ParentList":{  
               "__deferred":{  
                  "uri":"https://alhuber-ed2d692f50e990.sharepoint.com/Al_LVP/_api/Web/Lists(guid'd2c77a0b-bbe8-4f39-a161-edf9fcb5b860')/Items(1)/ParentList"
               }
            },
            "FileSystemObjectType":0,
            "Id":1,
            "ID":1,
            "ContentTypeId":"0x010600BB7BE592A5F7FE4E9149EA15B2C32721",
            "Title":"Huber",
            "Modified":"2014-10-02T05:38:17Z",
            "Created":"2014-10-02T05:38:17Z",
            "AuthorId":11,
            "EditorId":11,
            "OData__UIVersionString":"1.0",
            "Attachments":false,
            "GUID":"ddd5bbc9-5638-4489-b742-8c32d27fc4c4",
            "FirstName":"Alex",
            "FullName":"Alex Huber",
            "Email":null,
            "Company":null,
            "JobTitle":null,
            "WorkPhone":null,
            "HomePhone":"079 885 16 26",
            "CellPhone":"079 885 16 26",
            "WorkFax":null,
            "WorkAddress":null,
            "WorkCity":null,
            "WorkState":null,
            "WorkZip":null,
            "WorkCountry":null,
            "WebPage":null,
            "Comments":"<div></div>"
         },
         { 2nd object results Array},
         { 3d object results Array},
         { 4nd object results Array},
      ]
  }
}
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
Use
ajax.dataSrcset tod.resultsand thencolumns.dataset to be the name of the properties you want for each column -Idetc.Allan
Hi Allan
Thanks for your help, this did the trick..(-;
Alex