60 case json::Value::Kind::Null:
62 case json::Value::Kind::Number: {
63 if (
auto x = V->getAsInteger()) {
68 }
else if (
auto x = V->getAsNumber()) {
74 std::cerr <<
"Error in desJson: Number is not int, or double\n";
78 case json::Value::Kind::String: {
79 std::string *ret =
new std::string();
80 *ret = V->getAsString()->str();
84 case json::Value::Kind::Boolean: {
85 bool *ret =
new bool();
86 *ret = V->getAsBoolean().getValue();
90 case json::Value::Kind::Array: {
94 auto arr = V->getAsArray();
96 auto it = arr->begin();
98 switch (first->kind()) {
99 case json::Value::Kind::Number: {
100 if (
auto x = first->getAsInteger()) {
101 std::vector<IntegerType> *ret =
new std::vector<IntegerType>();
102 for (
auto it : *arr) {
103 ret->push_back(it.getAsInteger().getValue());
107 }
else if (
auto x = first->getAsNumber()) {
108 std::vector<RealType> *ret =
new std::vector<RealType>();
109 for (
auto it : *arr) {
110 ret->push_back(it.getAsNumber().getValue());
115 std::cerr <<
"Error in desJson: Number is not int, or double\n";
119 case json::Value::Kind::String: {
120 std::vector<std::string> *ret =
new std::vector<std::string>();
121 for (
auto it : *arr) {
122 ret->push_back(it.getAsString()->str());
127 case json::Value::Kind::Boolean: {
128 std::vector<uint8_t> *ret =
new std::vector<uint8_t>();
129 for (
auto it : *arr) {
130 ret->push_back(it.getAsBoolean().getValue());
136 std::cerr <<
"Error in desJson: Array is not of supported type\n";