comparison utilities/json-cli.cpp @ 24:533ca5ca3404

More on reading and writing json messages
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 23 May 2016 16:09:25 +0100
parents 913fc1d3710a
children 55d69b26d4db
comparison
equal deleted inserted replaced
23:d678cd00e593 24:533ca5ca3404
158 158
159 if (err != "") { 159 if (err != "") {
160 throw VampJson::Failure("invalid request: " + err); 160 throw VampJson::Failure("invalid request: " + err);
161 } 161 }
162 162
163 if (!j["verb"].is_string()) { 163 if (!j["type"].is_string()) {
164 throw VampJson::Failure("verb expected in request"); 164 throw VampJson::Failure("type expected in request");
165 } 165 }
166 166
167 if (!j["content"].is_null() && 167 if (!j["content"].is_null() &&
168 !j["content"].is_object()) { 168 !j["content"].is_object()) {
169 throw VampJson::Failure("object expected for content"); 169 throw VampJson::Failure("object expected for content");
170 } 170 }
171 171
172 string verb = j["verb"].string_value(); 172 string verb = j["type"].string_value();
173 Json content = j["content"]; 173 Json content = j["content"];
174 Json result; 174 Json result;
175 175
176 if (verb == "list") { 176 if (verb == "list") {
177 result = handle_list(content); 177 result = handle_list(content);