Many things can be serialized in Javascript, including strings. For example, if you stringify:
const foo = 'foo';
JSON.stringify(foo);
you get
"foo"
Here, because you're stringifying a string the same way:
response =JSON.stringify('[{"file": "app.dll", "fields": {"name": "Misc App", "rank": 1}}]');
When you parse it later, you get back the original string, as intended.
Either don't stringify it at all initially:
let response = '[{"file": "app.dll", "fields": {"name": "Misc App", "rank": 1}}]';
response = JSON.parse(response);
console.log(response);
response.forEach(function(element){
console.log(element);
});
Or, if you really have to, parse it twice:
let response = JSON.stringify('[{"file": "app.dll", "fields": {"name": "Misc App", "rank": 1}}]');
response = JSON.parse(JSON.parse(response));
console.log(response);
response.forEach(function(element){
console.log(element);
});
(but that's a very weird solution - it'd be better by far not to stringify the string in the first place, since it's already in parseable JSON format)
stringifya string. Guess what is the result datatype ? ;)