Skip to content

Commit

Permalink
lib.trivial.importJSON: add example
Browse files Browse the repository at this point in the history
Add parity with importTOML.
  • Loading branch information
TheCodedProf committed Jun 7, 2024
1 parent bdb3c20 commit 474d1b0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/trivial.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 474d1b0

Please sign in to comment.