diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-05-10 14:49:18 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-04 09:16:06 +0200 |
commit | 21c10de8c2de17a6357dbbcea7613b41f6ab8449 (patch) | |
tree | 3bb0e6e27fd438edc0f8906321a1544e3ddc8777 /src | |
parent | 6c7bee062437acbc078533fdcf8e53794031bf99 (diff) |
special threatment for null,true,false because they are non valid json
Diffstat (limited to 'src')
-rw-r--r-- | src/rpcclient.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp index 8b7b9e1493..bedf9ffbcb 100644 --- a/src/rpcclient.cpp +++ b/src/rpcclient.cpp @@ -11,6 +11,8 @@ #include <set> #include <stdint.h> +#include <boost/algorithm/string/case_conv.hpp> // for to_lower() + using namespace std; using namespace json_spirit; @@ -134,9 +136,19 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri // parse string as JSON, insert bool/number/object/etc. value else { + //according to rfc4627 null, true, false are not valid json strings Value jVal; - if (!jVal.read(strVal)) - throw runtime_error(string("Error parsing JSON:")+strVal); + if(strVal == "null") + jVal.setNull(); + else if(strVal == "true") + jVal.setBool(true); + else if(strVal == "false") + jVal.setBool(false); + else + { + if (!jVal.read(strVal)) + throw runtime_error(string("Error parsing JSON:")+strVal); + } params.push_back(jVal); } } |