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

Add ability to print/decode top level JSON Array

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.3
    • Affects Version/s: None
    • Component/s: Usability
    • None
    • Fully Compatible

      The JSON RFC that arrays are valid top-level JSON objects:

         A JSON text is a sequence of tokens.  The set of tokens includes six
         structural characters, strings, numbers, and three literal names.
      
         A JSON text is a serialized object or array.
      
            JSON-text = object / array
      

      This ticket is for adding the ability to test for and parse arrays in strings as well as the ability to print them. Example usage:

      StringData json("[ 123, \"abc\", ... ]");
      if (isArray(json)) {
          BSONArray arr = fromjson(json);
          std::cout << printjson(arr) << std::endl;
      }
      

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            tyler@10gen.com Tyler Brock
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: