简体   繁体   中英

Converting Json dict to Yaml

I am running Python script to get data as dict (json) how can I convent this Json dict to yaml without reading / writing to a file.

just to convent Json object to YAML object. thanks

import simplejson
import sys
import yaml
 
print yaml.dump(simplejson.loads(str(sys.stdin.read())), default_flow_style=False)

Python one-liner: converting JSON to YAML Check this: https://blog.jasoncallaway.com/2015/10/11/python-one-liner-converting-json-to-yaml/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM