Created
September 27, 2022 06:16
-
-
Save seymanurmutlu/7f1812d45ba9def96bf55219f0481d43 to your computer and use it in GitHub Desktop.
aws-user-list-json-to-dataframe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import json | |
from pandas import json_normalize | |
with open('aws-users.json', 'r', encoding = 'utf-16') as file: | |
data = file.read().replace('\n', '') | |
dict = json.loads(data) | |
df2 = json_normalize(dict['Users']) | |
print(df2.head()) | |
"""" | |
Example Data | |
{ | |
"Users": [ | |
{ | |
"Path": "/", | |
"UserName": "john.doe@example.com", | |
"UserId": "user-id", | |
"Arn": "arn:aws:iam::....", | |
"CreateDate": "2018-07-10T09:30:51+00:00", | |
"PasswordLastUsed": "2021-06-21T07:42:36+00:00" | |
}, | |
{ | |
"Path": "/", | |
"UserName": "john.doe2@example.com", | |
"UserId": "user-id", | |
"Arn": "arn:aws:iam::....", | |
"CreateDate": "2022-05-30T06:06:07+00:00", | |
"PasswordLastUsed": "2022-09-01T21:17:43+00:00" | |
} | |
] | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment