diff options
author | Samuel Shuert <me@thecoded.prof> | 2024-06-07 17:22:17 -0400 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-06-13 03:12:03 +0200 |
commit | cfc6c9b6e433009a3f5c0a4c9cab526e09bd760a (patch) | |
tree | 589a5d29db3b297c4e9b57fdf2e35f492c6fee7a | |
parent | 64f0f7a448ae743b7393a150bdc47553ea75b66c (diff) |
lib.trivial.importJSON: add example
Add parity with importTOML.
-rw-r--r-- | lib/trivial.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index f4a8f0d9bec57..3284e3dbe4838 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 |