Difference between revisions of "JSON Function"
Jump to navigation
Jump to search
| Line 16: | Line 16: | ||
return result; | return result; | ||
</pre> | </pre> | ||
| + | |||
| + | <pre> | ||
| + | var obj = JSON.parse(input); | ||
| + | var result = { | ||
| + | "count" = obj.result.count() | ||
| + | }; | ||
| + | for (var i=0; i<obj.result.count();i++) { | ||
| + | result[i] = obj.result[i].sys_id; | ||
| + | } | ||
| + | return result; | ||
| + | </pre> | ||
Revision as of 11:42, 8 July 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;
var obj = JSON.parse(input);
var result = {
"count" = obj.result.count()
};
for (var i=0; i<obj.result.count();i++) {
result[i] = obj.result[i].sys_id;
}
return result;