-1
I have a research connection to a API graphql, this search returns a JSON, where I store it in content
and then turn it into an array, but this array is not showing the values contained in it, keeps the values in [array]
, instead of showing via console.log()
Script
require('es6-promise').polyfill();
require('isomorphic-fetch');
let queryAPI = {
"query": `{
squads {
name
cards(includedOnKanban: true, closed: false, archived: false, cancelled: false, updatedSince: \"2020-01-01T00:00:00-0300\") {
identifier
title
description
status
priority
assignees {
fullname
email
}
}
}
}`
};
(async () => {
const rawResponse = await fetch('https://www.bluesight.io/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Bluesight-API-Token': 'token-here'
},
body: JSON.stringify(queryAPI)
});
const content = await rawResponse.json();
//console.log(JSON.stringify(content.data));
var result = [];
for(var i in content)
result.push([i, content[i]]);
console.log(content[i])
})();
JSON String example:
{ "date": { "squads": [ { "name": "SUPPORT IT", "cards": [ { "Dentifier": "06x38y", "title": "ALL - Validate data, "Description": "review database.", "status": null, "Priority": "medium", "assignees": [ { "fullname": "Carlos", "email": "[email protected]", } ] } ] } ] } }
OUTPUT
{
squads: [ { name: 'SUPPORT IT', cards: [Array] } ]
}
opaaa, was msm my doubt, mt obg!!
– Luis Henrique