{"id":9425,"date":"2018-01-17T16:07:55","date_gmt":"2018-01-17T15:07:55","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/hayek\/jochen\/wp\/blog-en\/?p=9425"},"modified":"2018-01-17T16:07:55","modified_gmt":"2018-01-17T15:07:55","slug":"extract-jira-issue-content","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2018\/01\/17\/extract-jira-issue-content\/","title":{"rendered":"extracting fields from a Jira &#8220;issue&#8221; (like a very nice and useful description)? how to get the markup source of the issue description?"},"content":{"rendered":"<p>\t\t\t\tNo, Jira does not let you read (&#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_Latin_phrases_(P)#per_se\">per se<\/a>&#8220;) the markup source of an &#8220;issue&#8221; \u2013 that&#8217;s why I went this way in the first place\u00a0 \ud83d\ude44<\/p>\n<ul>\n<li><a href=\"http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/02\/jira-rest-api\/\">http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/02\/jira-rest-api\/<\/a>\u00a0\u2013 using Jira&#8217;s REST API: a &#8220;\u2026\/rest\/api\/2\/issue\/\u2026&#8221; URL<\/li>\n<li><a href=\"http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/22\/jq-json-processor\/\">http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/22\/jq-json-processor\/<\/a> \u2013 how to use <code>jq<\/code> for json-tidying<\/li>\n<\/ul>\n<pre>jq . X.json &gt; X.pretty.json<\/pre>\n<ul>\n<li><a href=\"http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2018\/01\/17\/json-extract-structure\/\">http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2018\/01\/17\/json-extract-structure\/<\/a>\u00a0\u2013 extract the structure tree of your JSON data using <code>jq<\/code>\u00a0and a nice command line<\/li>\n<\/ul>\n<pre>jq -c 'path(..)|[.[]|tostring]|join(\"\/\")|\".\"+.' X.pretty.json<\/pre>\n<ul>\n<li>the field we are interested in is <code>fields\/description<\/code><\/li>\n<\/ul>\n<pre>jq \".fields.description\" X.json &gt; X.description.txt<\/pre>\n<ul>\n<li>save the value of that field to a separate file!<\/li>\n<li>remove the leading and trailing double-quotes!<\/li>\n<li>replace all <code>\\\"<\/code> with ordinary double-quotes!<\/li>\n<li>remove <code>\\r<\/code>!<\/li>\n<li>replace <code>\\n<\/code> with ordinary new-lines!<\/li>\n<\/ul>\n<pre>jq \".fields.description\" X.json | \nperl -pe 's\/^\"(.*)\"$\/$1\/; s\/\\\\\"\/\"\/g; s\/\\\\r\/\/g; s\/\\\\n\/\\n\/g' &gt; X.description.txt<\/pre>\n<ul>\n<li>\u2026<\/li>\n<li>looks good, doesn&#8217;t it?<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>No, Jira does not let you read (&#8220;per se&#8220;) the markup source of an &#8220;issue&#8221; \u2013 that&#8217;s why I went this way in the first place\u00a0 \ud83d\ude44 http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/02\/jira-rest-api\/\u00a0\u2013 using Jira&#8217;s REST API: a &#8220;\u2026\/rest\/api\/2\/issue\/\u2026&#8221; URL http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2015\/12\/22\/jq-json-processor\/ \u2013 how to use jq for json-tidying jq . X.json &gt; X.pretty.json http:\/\/Jochen.Hayek.name\/wp\/blog-en\/2018\/01\/17\/json-extract-structure\/\u00a0\u2013 extract the structure tree of your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[29,82,289,334],"tags":[1126,1130],"class_list":["post-9425","post","type-post","status-publish","format-standard","hentry","category-atlassian-jira","category-cygwin","category-json","category-markup-language","tag-jq","tag-json-tidy"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-2s1","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/9425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=9425"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/9425\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=9425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=9425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=9425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}