-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Description
here is my code:
#include <stdio.h>
#include<stdlib.h>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main(int argc, char **argv){
// create object from string literal
// parse explicitly
std::string text = "{ \"happy\": true, \"pi\": 3.141 }";
auto j = json::parse(text);
std::string str = j.dump();
printf("j=%s \n", str);
printf("happy=%d, pi=%f \n", j["happy"], j["pi"]);
return 0;
}this is build:
g++ -Wall -std=c++14 -I./json/include -L./json/lib test4.cpp -o t4
and result:
./t4
j=
happy=25431392, pi=0.000000
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels