---
作りかけのPythonスクリプト
# 出力部分は、間違いなく修正が必要。
# 最悪、手動......
# 変数の命名規則ってあるんですか?
---
import json
import sys
import re
args = sys.argv
filename = args[1]
with open(filename, "r") as f:
json_data = json.load(f)
for list in json_data.values():
for resourcedict in list:
ResouceType = resourcedict["ResourceType"]
ResourceIdentifier = resourcedict["ResourceIdentifier"]
RType = ResouceType.split(":")[-1]
LogicalResourceId = RType + "00"
for value in ResourceIdentifier.values():
LogicalResourceId = LogicalResourceId + value
LogicalResourceId = re.sub(r'[^a-zA-Z0-9]', '', LogicalResourceId)
json_datas = f'{{"ResouceType": "{ResouceType}","LogicalResourceId": "{LogicalResourceId}","ResourceIdentifier": {ResourceIdentifier} }}'
print(json_datas)
with open('./resulet.json', 'a') as g:
g.write(f"{json_datas},")
---