Hey everyone, I have a script that does an API call, the results are displayed in a json array, but i am trying to break them down into HTML tables

here is my code

  var deviceId = ""; 

 api.call("Get", {
    typeName : "DutyStatusLog",
    search : {
            deviceSearch : {
                    driver : deviceId
            }
    }
}, function (result) {
    if (result !== null && result.length > 0) {
        document.getElementById("dataString").innerHTML = JSON.stringify(result[0])
    }
}, function (errorString) {
    alert(errorString);
});

and the output is :

{"id":"aOfoqjT0Yr0igg2i3PCXrGg","location":{"location":{"x":-76.86248779296875,"y":41.004390716552734}},"status":"Login","origin":"Automatic","device":{"id":"b2F"},"dateTime":"2017-11-24T15:38:01.620Z","driver":{"id":"b12"},"state":"Active","malfunction":"None","version":"00000000000060c1","sequence":"000000000000025a","eventRecordStatus":1,"eventCode":1,"eventType":5,"distanceSinceLastValidCoordinate":0}

WHat i want to know is how can i get this above string formatted into an HTML table and automaticall create rows when it loops?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.