I am using NodeJS, and the following JSON.parse is failing but I cant work out why:
> s[0]
'[["hands[0].session.buyin", "332"]]'
> JSON.parse(s[0]);
SyntaxError: Unexpected token
at Object.parse (native)
at repl:1:6
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at
The string in question has been loaded from a file. If I copy past the string into the console it works, so my suspicion is that it might be to do with the way the file is encoded, but I just cant work out what. JSON.parse's error messages are distinctly unhelpful.
s[0]looks like two-dimensional array, isn't it?JSON.parse('[["hands[0].session.buyin", "332"]]')works as expected.