Having some challenges with postgresql(9.4) and javascript. I'm attempting to convert a jsonb[] datatype into an array/list of JSON values in javascript, containing only one element(json) for simplicity.
var s = { "player": "{\"{\\\\\"username\\\\\": \\\\\"JetJet13\\\\\", \\\\\"points\\\\\": 525, \\\\\"level\\\\\": 3"}\"}" };
This is what has been attempted so far:
JSON.parse(s.player); //this results in an error: SyntaxError: Unexpected token }
This is the desired result:
var s = { "player": [ {"username": "JetJet13", "points": 525, "level": 3} ] };
Any assistance on this matter would be greatly appreciated.