diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-06-19 21:45:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-19 21:45:34 +0200 |
commit | d88be9b70cfecb0ec525216c1bb6267c9d1aa17d (patch) | |
tree | f0493f77faaea415faab110fe00cb71d27ebea0e /modules/jsonrpc/jsonrpc.cpp | |
parent | d7a42a44be107d048447dcaeba7c508402096d90 (diff) | |
parent | 2bafcd3422bea8baf2282f5de87538a59f0bb254 (diff) |
Merge pull request #44806 from madmiraal/consolidate_json
Consolidate JSON, JSONParseResults and JSONParser into JSON
Diffstat (limited to 'modules/jsonrpc/jsonrpc.cpp')
-rw-r--r-- | modules/jsonrpc/jsonrpc.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/jsonrpc/jsonrpc.cpp b/modules/jsonrpc/jsonrpc.cpp index 306c0ff087..3d0759d83e 100644 --- a/modules/jsonrpc/jsonrpc.cpp +++ b/modules/jsonrpc/jsonrpc.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "jsonrpc.h" + #include "core/io/json.h" JSONRPC::JSONRPC() { @@ -156,19 +157,17 @@ String JSONRPC::process_string(const String &p_input) { } Variant ret; - Variant input; - String err_message; - int err_line; - if (OK != JSON::parse(p_input, input, err_message, err_line)) { - ret = make_response_error(JSONRPC::PARSE_ERROR, "Parse error"); + JSON json; + if (json.parse(p_input) == OK) { + ret = process_action(json.get_data(), true); } else { - ret = process_action(input, true); + ret = make_response_error(JSONRPC::PARSE_ERROR, "Parse error"); } if (ret.get_type() == Variant::NIL) { return ""; } - return JSON::print(ret); + return ret.to_json_string(); } void JSONRPC::set_scope(const String &p_scope, Object *p_obj) { |