InfluxDB JSON response formatting
I have a JSON response from influxdb http query as below:
{
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
}
I want to display the above content in the below format in JavaScript.
File_Download 9
View_File 8
Open_TEAM 7
Open_OneDrive 6
File_Upload 5
File_Download 4
I am completely new to JavaScript/json. Appreciate someone could help me. Many Thanks
My attempt:
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
The output comes as below:
[ 'time', 'transactionName', 'responseTime' ]
**********************************************
[ '2018-11-20T09:16:15.1442021Z', 'Security_Question', 3.750389 ]
[ '2018-11-20T09:16:14.7631577Z', 'File_Download', 5.369951 ]
[ '2018-11-20T09:16:13.9440692Z', 'View_File', 13.827224 ]
[ '2018-11-20T09:16:13.3379987Z', 'Open_TEAM', 17.779691 ]
[ '2018-11-20T09:16:12.9609559Z', 'File_Upload', 38.956707 ]
[ '2018-11-20T09:16:12.5737327Z', 'Open_OneDrive', 2.949066 ]
[ '2018-11-20T09:16:12.0929475Z', 'Logout', 11.773299 ]
[ '2018-11-20T09:13:50.9144754Z','Login_OKTA',6.6948170000000005 ]
[ '2018-11-20T09:13:36.2807192Z', 'HomePage', 2.719711 ]
javascript html json
add a comment |
I have a JSON response from influxdb http query as below:
{
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
}
I want to display the above content in the below format in JavaScript.
File_Download 9
View_File 8
Open_TEAM 7
Open_OneDrive 6
File_Upload 5
File_Download 4
I am completely new to JavaScript/json. Appreciate someone could help me. Many Thanks
My attempt:
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
The output comes as below:
[ 'time', 'transactionName', 'responseTime' ]
**********************************************
[ '2018-11-20T09:16:15.1442021Z', 'Security_Question', 3.750389 ]
[ '2018-11-20T09:16:14.7631577Z', 'File_Download', 5.369951 ]
[ '2018-11-20T09:16:13.9440692Z', 'View_File', 13.827224 ]
[ '2018-11-20T09:16:13.3379987Z', 'Open_TEAM', 17.779691 ]
[ '2018-11-20T09:16:12.9609559Z', 'File_Upload', 38.956707 ]
[ '2018-11-20T09:16:12.5737327Z', 'Open_OneDrive', 2.949066 ]
[ '2018-11-20T09:16:12.0929475Z', 'Logout', 11.773299 ]
[ '2018-11-20T09:13:50.9144754Z','Login_OKTA',6.6948170000000005 ]
[ '2018-11-20T09:13:36.2807192Z', 'HomePage', 2.719711 ]
javascript html json
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35
add a comment |
I have a JSON response from influxdb http query as below:
{
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
}
I want to display the above content in the below format in JavaScript.
File_Download 9
View_File 8
Open_TEAM 7
Open_OneDrive 6
File_Upload 5
File_Download 4
I am completely new to JavaScript/json. Appreciate someone could help me. Many Thanks
My attempt:
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
The output comes as below:
[ 'time', 'transactionName', 'responseTime' ]
**********************************************
[ '2018-11-20T09:16:15.1442021Z', 'Security_Question', 3.750389 ]
[ '2018-11-20T09:16:14.7631577Z', 'File_Download', 5.369951 ]
[ '2018-11-20T09:16:13.9440692Z', 'View_File', 13.827224 ]
[ '2018-11-20T09:16:13.3379987Z', 'Open_TEAM', 17.779691 ]
[ '2018-11-20T09:16:12.9609559Z', 'File_Upload', 38.956707 ]
[ '2018-11-20T09:16:12.5737327Z', 'Open_OneDrive', 2.949066 ]
[ '2018-11-20T09:16:12.0929475Z', 'Logout', 11.773299 ]
[ '2018-11-20T09:13:50.9144754Z','Login_OKTA',6.6948170000000005 ]
[ '2018-11-20T09:13:36.2807192Z', 'HomePage', 2.719711 ]
javascript html json
I have a JSON response from influxdb http query as below:
{
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
}
I want to display the above content in the below format in JavaScript.
File_Download 9
View_File 8
Open_TEAM 7
Open_OneDrive 6
File_Upload 5
File_Download 4
I am completely new to JavaScript/json. Appreciate someone could help me. Many Thanks
My attempt:
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
The output comes as below:
[ 'time', 'transactionName', 'responseTime' ]
**********************************************
[ '2018-11-20T09:16:15.1442021Z', 'Security_Question', 3.750389 ]
[ '2018-11-20T09:16:14.7631577Z', 'File_Download', 5.369951 ]
[ '2018-11-20T09:16:13.9440692Z', 'View_File', 13.827224 ]
[ '2018-11-20T09:16:13.3379987Z', 'Open_TEAM', 17.779691 ]
[ '2018-11-20T09:16:12.9609559Z', 'File_Upload', 38.956707 ]
[ '2018-11-20T09:16:12.5737327Z', 'Open_OneDrive', 2.949066 ]
[ '2018-11-20T09:16:12.0929475Z', 'Logout', 11.773299 ]
[ '2018-11-20T09:13:50.9144754Z','Login_OKTA',6.6948170000000005 ]
[ '2018-11-20T09:13:36.2807192Z', 'HomePage', 2.719711 ]
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
var response = getResponse();
for (var i = 0; i < response.results.length; i++) {
for (var t = 0; t < response.results[i].series.length; t++) {
console.log(response.results[i].series[t].columns);
console.log("**********************************************");
for (var j = 0; j < response.results[i].series[t].values.length; j++) {
console.log(response.results[i].series[t].values[j])
}
}
}
function getResponse() {
return {
"results": [{
"statement_id": 0,
"series": [{
"name": "healthCheckTestV1",
"columns": ["time", "transactionName", "responseTime"],
"values": [
["2018-11-20T08:09:50.4799222Z", "Security_Question", 4.167099],
["2018-11-20T08:09:50.0868723Z", "File_Download", 4.867642],
["2018-11-20T08:09:49.6968331Z", "View_File", 9.709544],
["2018-11-20T08:09:49.3077855Z", "Open_TEAM", 18.121819],
["2018-11-20T08:09:48.9147399Z", "File_Upload", 9.891604],
["2018-11-20T08:09:47.0675403Z", "Open_OneDrive", 2.793456],
["2018-11-20T08:09:46.5719031Z", "Logout", 11.781315],
["2018-11-20T08:08:06.0374685Z", "Login_OKTA", 7.293168],
["2018-11-20T08:07:49.8022407Z", "HomePage", 3.037265]
]
}]
}]
};
}
javascript html json
javascript html json
edited Nov 20 '18 at 13:32
barbsan
2,43621223
2,43621223
asked Nov 20 '18 at 8:46
Anees MohammedAnees Mohammed
62
62
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35
add a comment |
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389191%2finfluxdb-json-response-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389191%2finfluxdb-json-response-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried accesing data in this response? How are these numbers in expected output related to your dataset?
– barbsan
Nov 20 '18 at 9:06
sorry its just an example of the output. Ideally it should be with decimals
– Anees Mohammed
Nov 20 '18 at 11:51
I've replaced in your code that part where you parsed JSON with your object (now it's working snippet and other users can easily modify it) and added back subject of this question. IMO Array#forEach may help you. Is it ok for you to log it (into console) or are you going to display it using html?
– barbsan
Nov 20 '18 at 13:42
@Barbsan - thanks. I need to return it as string variable. As next step I need to hook this code into AWS lambda and then integrate with AWS LEX.
– Anees Mohammed
Nov 21 '18 at 9:23
Well, it seems that your goal is quite different than the one you posted in question - there's some table-like content you want to display, now it's string variable. Do you know what should be in content of this string variable? It's not clear what you're trying to achieve and this question may become too broad soon. Read how to ask
– barbsan
Nov 21 '18 at 9:35