lib.trivial.importJSON: add example

Add parity with importTOML.
This commit is contained in:
Samuel Shuert 2024-06-07 17:22:17 -04:00 committed by Silvan Mosberger
parent 64f0f7a448
commit cfc6c9b6e4

View File

@ -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