wangzhengquan
2020-06-30 04ca103d9c561e62bbb557c5db30771c17a7bdbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
#include <iostream> 
#include <fstream>
#include <jsoncpp/json/json.h>
 
using namespace std;
 
int main() {
    ifstream ifs("data/profile.json");
    Json::Reader reader;
    Json::Value obj;
    reader.parse(ifs, obj); // Reader can also read strings
    cout << "Last name: " << obj["lastname"].asString() << endl;
    cout << "First name: " << obj["firstname"].asString() << endl;
    return 1;
}