Restructing the source layout to make it nicer.
This commit is contained in:
parent
fff182b457
commit
cc3bb171e1
14 changed files with 166 additions and 33 deletions
27
scratchpad/jsontest.cpp
Normal file
27
scratchpad/jsontest.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <fmt/core.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
using namespace fmt;
|
||||
using std::string, std::cout;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc != 2) {
|
||||
println("USAGE: jsontest [jsonfile]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::ifstream infile(argv[1]);
|
||||
json data = json::parse(infile);
|
||||
|
||||
json::string_t s2 = data["happy"].template get<string>();
|
||||
|
||||
for(auto &el : data.items()) {
|
||||
cout << el.key() << "=" << el.value() << "\n";
|
||||
}
|
||||
|
||||
println("DATA HAPPY {}", s2);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue