Using Sheetdb for the first time and it seems very strange to me that client.read() returns a string rather than a JS object (since it is already in JSON).
Parsing is as simple as json = JSON.parse(data), but it still seems odd that the module wouldn't return the data as an object since in order to do anything with the data you have to parse it...
Code to reproduce
client.read({})
.then(function(data) {
console.log('Original object: ' + data[0])
json = JSON.parse(data)
console.log('JSON Object: ' + json[0]);
},
function(err){
console.log(err);
});
Output
Original object: [
JSON Data: {
Player: 'Smith',
Score: '41',
Comment: ''
}
Using Sheetdb for the first time and it seems very strange to me that client.read() returns a string rather than a JS object (since it is already in JSON).
Parsing is as simple as
json = JSON.parse(data), but it still seems odd that the module wouldn't return the data as an object since in order to do anything with the data you have to parse it...Code to reproduce
Output