- Version: 10.3.0 and 10.5.0
- Platform: MacOS
- Subsystem: CLI
When entering (or pasting) a multi-line object with string keys -- e.g. any JSON object -- the Node CLI correctly asks for more input with a ... prompt, but then incorrectly fails with a SyntaxError: Unexpected token :.
Example:
$ node --version
v10.3.0
$ node
> {"foo":false}
{ foo: false }
> {
... "foo":false
"foo":false
^
SyntaxError: Unexpected token :
This problem only occurs with string keys; bare keys work fine:
> {
... foo:false
... }
{ foo: false }
reproduced on 10.5.0 as well
This is an important issue because JSON objects are all string-keyed, and this parsing bug makes it impossible to copy and paste valid, pretty-printed JSON into the console.