如何使用给定的输出数据生成json文件

时间:2019-06-14 14:41:04

标签: python json jira

我有一个代码,可以为我提供JIRA站点的输出,即JIRA项目的描述字段,所以我想要实现的是从输出数据中获取某些字段并以某种格式生成json文件。

任何有关如何进一步开展工作的建议都将非常感激

This is the main python code:
=============================================================


from jira import JIRA

options = {'server': 'https://jira.testsite.com/'}
jira = JIRA("https://jira.testsite.com/", basic_auth=("username", "password"))

issue = jira.issue('ISSUE-number')

print(issue.fields.description)
=============================================================
The output i get from the above code is as follows:


*To Do:*



Issue data for 2018/12/31-2019/02/09 due to bla blaaaa...

Note: This was loaded on 2019/05/10



*Feeds:*

|data_test_no|name|

|29|Sample1.XXXXXXXX.v1.2a|

|42|Sample2.YYYYYYY.v1.2a|

|204|Sample3.v1.2a_ZZZZZZZ|

etc etc etc..........................




所以我想获取开始日期,即2018/12/31,结束日期:2019/02/09 并命名为Sample1.XXXXXXXX.v1.2a,Sample2.YYYYYYY.v1.2a ....

我希望它是json文件格式:(想要以上输出的结果)

{
 "user": "dexter",
 "ticket": "ISSUE-number",
 "start_date": "2018-12-31",
 "end_date": "2019-02-09",
 "data_names": [
    "Sample1.XXXXXXXX.v1.2a",
    "Sample2.YYYYYYY.v1.2a",
    "Sample3.v1.2a_ZZZZZZZ"
  ]
}```

0 个答案:

没有答案