I'm encountering difficulty with decoding an array of strings that I initially thought were in JSON format.
var result = [
"{gene: 'PEX2', go_bp: '0.766500871709', CombinedPvalue: '9.999999995E-4'}",
"{gene: 'PEX5', go_bp: '0.766472586087', CombinedPvalue: '9.999999995E-4'}",
"{gene: 'PEX7', go_bp: '0.766386859737', CombinedPvalue: '9.999999995E-4'}"
];
These are three instances of gene-related strings represented as JavaScript object literals, contained within a string. How can these be decoded?
My attempt to use JSON.parse
resulted in an error:
for (var i = 0; i < result.length; i++)
console.log(JSON.parse(result[i]));
The error message received was:
Uncaught SyntaxError: Unexpected token g
.
Is there a more straightforward solution for this issue?