-1

is there a way to convert json files into jsonnet files? I am working on grafana dashboards as code and need to convert a json file into jsonnet. Or is there a good guide on how to create panels in Grfana except the official Jsonnet website? I would be glad if I recieved any help from you!

M65
  • 27
  • 3

1 Answers1

0

JSON files are "technically" jsonnet files already, you can prettify them to look like jsonnet with:

jsonnetfmt file.json > file.jsonnet

Of course, the above is just syntax-sugar'izing the original JSON file.

If you want to build Grafana dashboards in a programmatic way, grafonnet-lib would be the way to go


jjo
  • 2,595
  • 1
  • 8
  • 16
  • Actually that did not do anything to my json file. The script is all the same and long as before, but just as jsonnet format. – M65 Dec 27 '22 at 13:33