I am trying to execute a nodejs script with python program and get the return output.
b.js
data : {
"1":[],
"2":[],
"3":[],
"4":[],
"5":[],
"6":[],
"7":[],
"8":[],
"9":[],
"10":[],
"11":[{"id":"1","domain":"www.xxxxx.com","keywords":"白银交易平台","type":"Type1","time":["11","14","15","18"]}]
}
console.log(JSON.stringify(data))
a.py
if response.exitcode == 0:
print(response.stdout)
else:
sys.stderr.write(response.stderr)
b'{"1":[],"2":[],"3":[],"4":[],"5":[],"6":[],"7":[],"8":[],"9":[],"10":[],"11":[{"id":"1","domain":"www.xxxx.com","keywords":"\xe7\x99\xbd\xe9\x93\xb6\xe4\xba\xa4\xe6\x98\x93\xe5\xb9\xb3\xe5\x8f\xb0","type":"Type1","time":["11","14","15","18"]}]}\n'
From official docs of naked, response.stdout is returned NakedObject. How can I convert the returned NakedObject to python dictionary ?
eval?eval(response.stdout)