mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-30 15:31:07 +00:00
20 lines
649 B
Markdown
20 lines
649 B
Markdown
|
## JSON To YAML Converter
|
||
|
|
||
|
If you are working with config files or need to expose YAML via an API, you will probably find yourself needing to convert a file from JSON to YAML format.
|
||
|
So I have tried to automate the same, by writing the following python script
|
||
|
|
||
|
For running this, you need to install/import the following libraries
|
||
|
```
|
||
|
|
||
|
- import json
|
||
|
- import yaml
|
||
|
```
|
||
|
|
||
|
|
||
|
Then in command prompt you just need to type:
|
||
|
```
|
||
|
|
||
|
python json2yaml.py input_file.json output_file.yaml
|
||
|
```
|
||
|
Here, input_file.json needs to be replaced with the name of your json file, and the output_file.yaml needs to be replaced with the name which you want for your yaml file.
|