#处理json字符串
def replace_json_value_bykey(data):
if data==np.nan
return np.nan
else:
import json
#读取成字典类型数据
data_json=json.loads(data)
dict=[]
def json_txt(dict_json):
if isinstance(dict_json,dict):
for key in dict_json:
if isinstance(dict_json[key],dict)
json_txt(dict_json[key])
dict[key]=dict_json[key]
else:
dict[key]=dict_json[key]
def replace_json_value(dict_json,k,v):
if isinstance(dict_json,dict):
for key in dict_json:
if key==k:
dict_json[key]=v
elif isinstance(dict_json[key],dict):
replace_json_value(dict_json[key],dict)
for temp_data in data_json:
replace_json_value(temp_data,'payAcct','*****')
return data_json
网友评论