對不起發佈不正確的格式,希望我現在的查詢很清楚。 我正在解析一個JSON,它基本上是我的框架的配置文件。 這是它的外觀: My JSON JSON Random Field's values在Python中對多維json進行迭代
我的代碼:
def makeCombination():
data = schemaConfig["PostData"]
out_json = []
for v1, v2, v3, v4, v5, v6 in product(data['size']['testing_type']['random'], data['start_index']['testing_type']['random'], data['campaign_sub_type']['testing_type']['random'], data['campaign_type']['testing_type']['random'], data['api_key']['testing_type']['random'], data['project_id']['testing_type']['random']):
out_json.append({'size': v1,'start_index': v2,'campaign_sub_type': v3,'campaign_type': v4,'api_key': v5, 'project_key': v6})
return out_json
def runRegressionFunc():
randomList = makeCombination()
tempOutList = list()
for comb in randomList:
tempDoc = dict()
for funcName in comb:
(key, val) = callOtherClasses(funcName)
tempDoc[key] = val
tempOutList.append(tempDoc)
return tempOutList
我想從makeCombination(所有領域的「隨機」所有可能的組合),這回runRegressionFunc() 。
P.S.我是新編碼世界:)
你可以發佈你的代碼的例子嗎? - 你如何解析這些數據? –
你的json有語法錯誤。 –
更新我的查詢,希望現在我能夠突出顯示我的查詢 – iamgroot