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

Add ability to print/decode top level JSON Array

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.3
    • Component/s: Usability
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      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;
      }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: