Skip to content

Instantly share code, notes, and snippets.

@techsolx
Created June 7, 2022 20:16
Show Gist options
  • Save techsolx/2e7e36d37fa6a4996b877c3dd4686a5b to your computer and use it in GitHub Desktop.
Save techsolx/2e7e36d37fa6a4996b877c3dd4686a5b to your computer and use it in GitHub Desktop.
Convert yaml to json using python. To use: cat <input.yaml> | yaml2json | tee <output.json>
#! /usr/bin/env python3
import json
import sys
import yaml
f = yaml.safe_load(sys.stdin.read())
json.dump(f, sys.stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment