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

V8 Scripting: Multiline JSON Arrays break using square brackets alone

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.0.2
    • Shell
    • None
    • OSX
    • ALL

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: