Difference between revisions of "JSON Function"
Jump to navigation
Jump to search
(Created page with "Basic JSON function var obj = JSON.parse(input); var result = { id:"", assignee_id:"", count:"", }; for (var k in result) { try { result[k] = (!obj.results[0][k] ) ? result[k...") |
|||
| Line 1: | Line 1: | ||
Basic JSON function | Basic JSON function | ||
| − | + | <code> <nowiki> | |
var obj = JSON.parse(input); | var obj = JSON.parse(input); | ||
var result = { | var result = { | ||
| Line 15: | Line 15: | ||
result.count = obj.count; | result.count = obj.count; | ||
return result; | return result; | ||
| + | </nowiki></code> | ||
Revision as of 14:59, 13 May 2020
Basic JSON function
var obj = JSON.parse(input);
var result = {
id:"",
assignee_id:"",
count:"",
};
for (var k in result) {
try {
result[k] = (!obj.results[0][k] ) ? result[k] : JSON.stringify(obj.results[0][k]);
} catch (e) {
}
}
result.count = obj.count;
return result;