Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
120 views
in Technique[技术] by (71.8m points)

python - extracting data from json with block type brackets into excel from array

to extract value of customfield_12676 , i just say customfield_12676.value in python how do i extract values when there is a [] type brackets have no idea how to get values from [] which i think is some kin

"customfield_12676": null,
    "customfield_10005": [
      {
        "id": 9348,
        "name": "Sprint 3 - 29 Dec to 15 Jan",
        "state": "closed",
        "boardId": 3497,
        "goal": "",
        "startDate": "2020-12-29T07:08:01.674Z",
        "endDate": "2021-01-15T07:08:00.000Z",
        "completeDate": "2021-01-18T11:33:27.415Z"
      },
      {
        "id": 9476,
        "name": "Sprint 4 - SU",
        "state": "active",
        "boardId": 3497,
        "goal": "Start Up Sprint",
        "startDate": "2021-01-18T11:35:38.562Z",
        "endDate": "2021-01-29T11:35:00.000Z"
      }
    ],

my actual python code

load_df = pd.concat([pd.read_json(f) for f in glob.glob(path)])
load_issues=(load_df['issues'])
data = pd.json_normalize(load_issues)

    FIELDS = [ "key", 
"fields.summary",
"fields.issuetype.name",
"fields.customfield_17461.value",
"fields.customfield_17460.value",
"fields.customfield_11110.value",
"fields.customfield_11102.value",
"fields.customfield_11364.value",
"fields.customfield_11363.value", 
"fields.project.id"
  lead.displayname
]

output_fields=data[FIELDS]


with pd.ExcelWriter(r'\xxxxxxFinancial_Shared_ServicesADMINISTRATIONFSSA_SHARED FOLDERFSSA_MI_QlikSenseFC_JIRA_ControlTestCloudOutputFC_Projects_test.xlsx',engine='xlsxwriter') as writer:
     output_fields.to_excel(writer)
question from:https://stackoverflow.com/questions/65936598/extracting-data-from-json-with-block-type-brackets-into-excel-from-array

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...