Last active
January 15, 2020 01:12
-
-
Save FrankHassanabad/06d2cc93a86992233accaf18abd25da8 to your computer and use it in GitHub Desktop.
Quick dirty toml to json converter which sorts the keys using jq and yj-macos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Download yj from: | |
# https://github.com/sclevine/yj/releases | |
# such as wget https://github.com/sclevine/yj/releases/download/v4.0.0/yj-macos | |
# | |
# Then chmod 755 ./yj-macos and chmod 755 toml_to_json.sh | |
# Go to your toml and run this | |
# toml_to_json.sh | |
rm -rf ./json | |
mkdir -p json | |
# "${name//-/_}" Replaces - with _ in the filenames | |
for f in *.toml ; do | |
name=$(basename -- "$f" .toml).json | |
cat $f | ./yj-macos -tj | jq -S . > json/"${name//-/_}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment