Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63720

add returnText option to writeJSON

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently the writeJSON step is only able to output the json to a file. However, sometimes we need the resulting json as a string in Groovy. The only workaround is either to write to some temp file and then call readJSON, or to directly call into JSONObject, neither of which is ideal.

      I propose adding a boolean returnText parameter to writeJSON. If it is omitted or false, then writeJSON preserves its existing behavior. If it is true, then file must not be specified and writeJSON will return the json as a string.

      Example usage:

      String json = writeJSON json: object, returnText: true

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            rsandell rsandell
            Reporter:
            rittneje Jesse Rittner
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: