Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6732

V8 Scripting: Multiline JSON Arrays break using square brackets alone

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.0.2
    • Component/s: Shell
    • None
    • Environment:
      OSX
    • ALL

      Whereas usually you can start typing an object, e.g.:

      > object = {
      ... "a": "b",
      ... "c": "d"
      ... };
      { "a" : "b", "c" : "d" }
      >
      

      the same breaks when you try to do so with an array - with the square bracket on its own.

      > array = [
      Wed Aug  8 15:15:08 SyntaxError: syntax error (shell):1
      

      It works when there's something after the square bracket, e,g.:

      > array = ["a",
      ... "b"]
      [ "a", "b" ]
      

      or:

      > array = [{
      ... "a":"b",
      ... }]
      [ { "a" : "b" } ]
      

      And fails when the remainder is concluded without the square bracket on the same line:

      > array = [{
      ... "a":"b"
      ... }
      Wed Aug  8 15:17:40 SyntaxError: missing ] after element list (shell):3
      

      This only happens on the top level, as demonstrated using a nested array:

      > array = [{
      ... "a":[
      ... "a"
      ... ]
      ... }]
      [ { "a" : [ "a" ] } ]
      

      I think this is to do with the V8 engine but don't really know.

            Assignee:
            tad Tad Marshall
            Reporter:
            dandart Dan Dart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: