Beautify a JSON response in Console-Output & Email

49 views
Skip to first unread message

Rami A.

unread,
Oct 13, 2015, 2:33:36 AM10/13/15
to Jenkins Users
Hi Guys,

We have a build that performs a REST call and gets a JSON response.
The response appears in the console-output not well formatted (just as a long string).

How can we print a nicely formatted JSON structure to the console?
Same but to an email? (we use the "Extended E-mail Notification" plugin to print the content but it's nicely printed either)

thank you,

Rami

Slide

unread,
Oct 13, 2015, 7:58:46 AM10/13/15
to Jenkins Users
For email-ext you could try using groovy.json.JsonOutput in a script token. It was introduced in Groovy 1.8 and I don't remember what version of Groovy is used right now (and don't have access to a computer).

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f7d52388-1b40-4007-b955-0adcf6cb536f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages