-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
-
2.7.0
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
- duplicates
-
JENKINS-48148 writeJson step to serialize to string variable
- Open