mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
special threatment for null,true,false because they are non valid json
This commit is contained in:
parent
6c7bee0624
commit
21c10de8c2
@ -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(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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user