File [nlohmann-json.py](nlohmann-json.py) contains a pretty printer for GDB for JSON values of this library. It was originally published as [Gist](https://gist.github.com/ssbssa/60da5339c6e6036b2afce17de06050ea#file-nlohmann-json-py) by [Hannes Domani](https://github.com/ssbssa).
## How to use
- Add line
```
source /path/to/nlohmann-json.py
```
to `~/.gdbinit`. Note you must replace `/path/to` with whatever path you stored file `nlohmann-json.py`.
- In GDB, debug as usual. When you want to pretty-print a JSON value `var`, type
```
p -pretty on -array on -- var
```
The result should look like
```
$1 = std::map with 5 elements = {
["Baptiste"] = std::map with 1 element = {
["first"] = "second"
},
["Emmanuel"] = std::vector of length 3, capacity 3 = {
3,
"25",
0.5
},
["Jean"] = 0.7,
["Zorg"] = std::map with 8 elements = {
["array"] = std::vector of length 3, capacity 3 = {