Browse Source
special threatment for null,true,false because they are non valid json
pull/4/head
Jonas Schnelli
9 years ago
committed by
Jack Grigg
No known key found for this signature in database
GPG Key ID: 6A6914DAFBEA00DA
1 changed files with
14 additions and
2 deletions
-
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; |
|
|
|
|
|
|
@ -150,9 +152,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); |
|
|
|
} |
|
|
|
} |
|
|
|