JSON C++ is a utility for Modern C++ to create and read JSON files.
Installation
Make sure you already have Git, GCC or Clang, CMake, GNU Make installed on your system.
Then clone, build and install with the following commands:
It will be Copied/Installed in directories similar to the ones below:
Basic usage example
To create a basic JSON.
vim hello-json.cpp
g++ hello-json.cpp
and run: ./a
Possible output:
Printing only the first element of JSON:
Possible output: "Hello"
Parsing
Example of a example.json
JSON file:
Print all content:
Possible output, note that the display has been changed to alphabetical order:
Print content with formatting:
Possible output,note that the display has been changed to alphabetical order :
Print only website content
Possible output: Terminal Root
.
Print the contents of {"details": {"tutorial"}}
:
Possible output: json C++
.
For complete documentation visit repository and official page .
cpp
cppdaily
Marcos Oliveira
Software developer