https://github.com/quinnj/JSON3.jl
https://github.com/quinnj/JSON3.jl
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/quinnj/JSON3.jl
- Owner: quinnj
- License: other
- Created: 2019-05-09T23:59:05.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-10-10T04:49:47.000Z (8 months ago)
- Last Synced: 2025-11-10T02:02:06.870Z (7 months ago)
- Language: Julia
- Size: 1.11 MB
- Stars: 226
- Watchers: 9
- Forks: 58
- Open Issues: 73
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-julia-security - JSON3.jl - High-performance JSON parser for processing API responses and structured data. (Data Forensics and Analysis / Data Parsing)
README
# JSON3.jl
## ⚠️ This package has been deprecated. Please migrate to [JSON.jl v1](https://github.com/JuliaIO/JSON.jl) (and see the [migration guide](https://juliaio.github.io/JSON.jl/stable/migrate/#Migration-guide-for-JSON3.jl)) ⚠️
Note: If you rely on the "automatically generate Julia struct definitions" feature from JSON3.jl, you may need to keep using JSON3.jl for now. See the [migration guide](https://juliaio.github.io/JSON.jl/stable/migrate/#Features-unique-to-each-library) for details.
### Documentation
[](https://quinnj.github.io/JSON3.jl/stable)
[](https://quinnj.github.io/JSON3.jl/dev)
*Yet another JSON package for Julia; this one is for speed and slick struct mapping*
### TL;DR
#### Basic
```julia
# builtin reading/writing
JSON3.read(json_string)
JSON3.write(x)
# custom types
JSON3.read(json_string, T; kw...)
JSON3.write(x)
```
#### More complicated
```julia
# custom types: incrementally update a mutable struct
x = T()
JSON3.read!(json_string, x; kw...)
JSON3.write(x)
# read from file
json_string = read("my.json", String)
JSON3.read(json_string)
JSON3.read(json_string, T; kw...)
# write to file
open("my.json", "w") do f
JSON3.write(f, x)
println(f)
end
# write a pretty file
open("my.json", "w") do f
JSON3.pretty(f, JSON3.write(x))
println(f)
end
# generate a type from json
using StructTypes
JSON3.@generatetypes json_string_sample
JSON3.read(json_string, JSONTypes.Root)
```