Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-20095

WriteJson shouldn't add newline if object or array is empty during pretty format

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 4.5.1, 5.0.0
    • 4.5.1, 5.0.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

      If the object or array is empty MarshalIndent doesn't add the new line. WriteJson should do same.

      The right output is

      insert into default values("k01",{"name":{},"arr":[]});
      insert into default values("k02",{"name":{"fname":"xyz"},"arr":[5]});
      select * from default;
      {
          "requestID": "73177554-f71c-47fa-9e4d-cd60573d3834",
          "signature": {
              "*": "*"
          },
          "results": [
              {
                  "default": {
                      "arr": [],
                      "name": {}
                  }
              },
              {
                  "default": {
                      "arr": [
                          5
                      ],
                      "name": {
                          "fname": "xyz"
                      }
                  }
              }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "41.800759ms",
              "executionTime": "41.699968ms",
              "resultCount": 2,
              "resultSize": 299
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Sitaram.Vemulapalli Sitaram Vemulapalli
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty