diff --git a/tools/put.cpp b/tools/put.cpp index 5ee201fda..cf21c17f5 100644 --- a/tools/put.cpp +++ b/tools/put.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "utilpvt.h" #include "evhelper.h" @@ -85,9 +86,10 @@ int main(int argc, char *argv[]) if(argc-optind==1 && std::string(argv[optind]).find_first_of('=')==std::string::npos) { // only one field assignment, and field name omitted. - // implies .value + // if JSON map, treat as entire struct. Others imply .value - values["value"] = argv[optind]; + auto sval(argv[optind]); + values[sval[0]=='{' ? "" : "value"] = sval; } else { for(auto n : range(optind, argc)) { @@ -118,9 +120,18 @@ int main(int argc, char *argv[]) auto val = std::move(prototype); for(auto& pair : values) { try{ - val[pair.first] = pair.second; - }catch(NoConvert& e){ - throw std::runtime_error(SB()<<"Unable to assign "<