Are my expectations incorrect? output desired is for a this single field
"{\"escapeChar\":\"\\\", \"quoteChar\":\"\"\", \"separatorChar\":\",\"}"
input csv text
"{""escapeChar"":""\\"", ""quoteChar"":""\"""", ""separatorChar"":"",""}"
Code:
obj_str = json.dumps(table_obj).replace('RS Target Table', 'Table Name').replace('Stage Table', 'input_table')
#Get obj back with replacement BANG!!
obj = json.loads(obj_str)
print ('after loads, source_serde_params: ', obj['source_serde_params'])
with open(filename, 'w' ) as write_file:
json.dump(obj, write_file, indent=2)
console:
after loads, source_serde_params: {"escapeChar":"\\", "quoteChar":"\"", "separatorChar":","}
output file:
"source_serde_params": "{\"escapeChar\":\"\\\\\", \"quoteChar\":\"\\\"\", \"separatorChar\":\",\"}"
python 3.7.9 windows laptop