Last active
November 2, 2024 14:49
-
-
Save pfuntner/cdf1e734371cafe904f78b6b836347e4 to your computer and use it in GitHub Desktop.
json-shell test file
This file contains hidden or 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
{ | |
"bools": [true, false], | |
"ints": [42, 32768, -1], | |
"floats": [3.141592654, 2.7182818285, -0.000001], | |
"strs": ["a", "b", "foo", "bar"], | |
"none": null, | |
"dict": { | |
"1": [".", "one", "One", "ONE"], | |
"2": ["..", "two", "Two", "TWO"] | |
} | |
} |
This file contains hidden or 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
{ | |
"level1": { | |
"level2": [ | |
{ | |
"var1": "value1" | |
}, | |
{ | |
"var2": "value2" | |
}, | |
"value3", | |
{ | |
"values": [ | |
{ | |
"var1": "Value1" | |
}, | |
{ | |
"var2": "Value2" | |
} | |
] | |
} | |
] | |
} | |
} |
This file contains hidden or 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
level1: | |
level2: | |
- var1: value1 | |
- var2: value2 | |
- value3 | |
- values: | |
- var1: Value1 | |
- var2: Value2 |
This file contains hidden or 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
#! /usr/bin/env python | |
import sys | |
import json | |
import yaml | |
assert not sys.stdin.isatty(), 'You must redirect stdin' | |
json.dump(yaml.load(sys.stdin.read(), Loader=yaml.BaseLoader), fp=sys.stdout, indent=2) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment