I want to pass json string from python code to shell script in original format like;
json_val = check_input_file['Item']['mappings']['S']
print(json_val)
The output of above code is:
{
"1": [
"skipColumn"
],
"2": [
"firstname"
],
"3": [
"lastname"
],
"4": [
"email"
],
"5": [
"skipColumn"
],
"6": [
"ipaddress"
]
}
So now I am passing json_val
to shell like:
init_script = '''#!/bin/bash
FOO="{0}"
echo $FOO
'''.format(json_val)
In FOO variable I get string without double quotes but I want it same as above.
I tried something like this
MAPPINGS=$(cat <<EOF
{"1":["skipColumn"],"2":["firstname"],"3":["lastname"],"4":["email"],"5":["skipColumn"],"6":["ipaddress"]}
EOF
)
But this is not what I want.
Am I missing something ?