From 9db804f72eed5eb3cef88bb91f7b4930f20eb439 Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Mon, 30 Dec 2024 20:06:02 +0100 Subject: [PATCH] Jsonrpc: Convert ids to int if they are int by value --- modules/jsonrpc/jsonrpc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/jsonrpc/jsonrpc.cpp b/modules/jsonrpc/jsonrpc.cpp index a3c0ce88bf5d..0f03e49fc8b7 100644 --- a/modules/jsonrpc/jsonrpc.cpp +++ b/modules/jsonrpc/jsonrpc.cpp @@ -122,6 +122,11 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem Variant id; if (dict.has("id")) { id = dict["id"]; + + // Account for implementations that discern between int and float on the json serialization level, by using an int if there is a .0 fraction. See #100914 + if (id.get_type() == Variant::FLOAT && id.operator float() == (float)(id.operator int())) { + id = id.operator int(); + } } if (object == nullptr || !object->has_method(method)) {