summaryrefslogtreecommitdiff
path: root/src/components/formatters/include/formatters/formatter_json_rpc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/formatters/include/formatters/formatter_json_rpc.h')
-rw-r--r--src/components/formatters/include/formatters/formatter_json_rpc.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/formatters/include/formatters/formatter_json_rpc.h b/src/components/formatters/include/formatters/formatter_json_rpc.h
index 593c837877..d1c87fe587 100644
--- a/src/components/formatters/include/formatters/formatter_json_rpc.h
+++ b/src/components/formatters/include/formatters/formatter_json_rpc.h
@@ -278,11 +278,14 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
ns_smart_objects::SmartObject& out) {
int32_t result = kSuccess;
try {
- Json::Value root;
- Json::Reader reader;
namespace strings = ns_smart_device_link::ns_json_handler::strings;
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder.newCharReader());
+ Json::Value root;
+ const size_t json_len = str.length();
- if (false == reader.parse(str, root)) {
+ if (!reader->parse(str.c_str(), str.c_str() + json_len, &root, nullptr)) {
result = kParsingError | kMethodNotSpecified | kUnknownMethod |
kUnknownMessageType;
} else {