I wanted to use python return /sys.exit value as variable for further processing.
#!/bin/bash
cat myjson.json | \
output=($(python -c 'import json,sys;obj=json.load(sys.stdin);
result =[];
for y in [x["_source"]["memberId"] for x in obj["hits"]["hits"]]:
result+=[y];
sys.exit(result)'))
echo 'output'$output
what is the best approach to read JSON data in the shell script using Python and store the Python output in an array variable of shell script