1 #include <iostream> 2 #include <iomanip> 3 #include <nlohmann/json.hpp> 4 5 using json = nlohmann::json; 6 main()7int main() 8 { 9 // a JSON text given an input with other values 10 std::vector<std::uint8_t> input = {'[', '1', ',', '2', ',', '3', ']', 'o', 't', 'h', 'e', 'r'}; 11 12 // parse and serialize JSON 13 json j_complete = json::parse(input.begin(), input.begin() + 7); 14 std::cout << std::setw(4) << j_complete << "\n\n"; 15 } 16