diff --git a/lib/trivial.nix b/lib/trivial.nix index 2b39f597f6390f3..b7255e4f098eeb1 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -623,6 +623,37 @@ in { /** Reads a JSON file. + # Examples + :::{.example} + ## `lib.trivial.importJSON` usage example + + example.json + ```json + { + "title": "Example JSON", + "hello": { + "world": "foo", + "bar": { + "foobar": true + } + } + } + ``` + + ```nix + importJSON ./example.json + => { + title = "Example JSON"; + hello = { + world = "foo"; + bar = { + foobar = true; + }; + }; + } + ``` + + ::: # Inputs