Skip to content

Commit 90ca5a2

Browse files
authored
docs: add example for pretty printing to file (#150)
1 parent 91cc554 commit 90ca5a2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/src/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ open("my_new_file.json", "w") do io
4646
end
4747
```
4848

49+
#### Write pretty JSON to a file
50+
```jl
51+
hello_world = Dict("a" => Dict("b" => 1, "c" => 2), "b" => Dict("c" =>3, "d" => 4))
52+
53+
open("my_new_file.json", "w") do io
54+
JSON3.pretty(io, hello_world)
55+
end
56+
```
57+
4958
#### Read JSON into a type
5059

5160
See more details on the types that are provided and how to customize parsing [below](#Struct-API).

0 commit comments

Comments
 (0)