[Python]Json看得眼花撩亂嗎?試試看cfn-flip這個工具吧!
因為最近都在寫AWS CloudFormation
,所以會接觸到大量的json以及yaml範本。
但json在閱讀上真的是很眼花撩亂…
所以找到了一個非常偉大的工具!
這個python套件在使用上非常的簡單明瞭。
安裝:
pip3 install cfn_flip
使用方法:
~ » cfn-flip
Usage: cfn-flip [OPTIONS] [INPUT] [OUTPUT]
AWS CloudFormation Template Flip is a tool that converts AWS
CloudFormation templates between JSON and YAML formats, making use of the
YAML format's short function syntax where possible.
Options:
-i, --input [json|yaml] Specify the input format. Overrides -j and -y flags.
-o, --output [json|yaml] Specify the output format. Overrides -j, -y, and -n flags.
-j, --json Convert to JSON. Assume the input is YAML.
-y, --yaml Convert to YAML. Assume the input is JSON.
-c, --clean Performs some opinionated cleanup on your template.
-l, --long Use long-form syntax for functions when converting to YAML.
-n, --no-flip Perform other operations but do not flip the output format.
--version Show the version and exit.
--help Show this message and exit.