If you are sending/working with lots of JSON data in files such as AWS CloudFormation templates, Jsonnet
tool can help reducing the hassle of maintaining.
Using Jsonnet templates, it is easier to organize data and reduce repeated code present in such JSON data.
This post goes over a few common Jsonnet code recipes for generating JSON data.
Automated tests
At least, make sure your jsonnet template files can compile. The following example bash script will find all the manifest files and try to compile that:
1 2 3 4 5 6 7 8 9 10 |
|
Conditional add
Conditionally adding items to a list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Conditionally adding attributes to an object/map.
1 2 3 4 5 6 7 |
|