You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue where a function taking parameters of int, std::tuple<double, double, double> seems like it is getting detected as int, json-object instead of int, json-array.
nlohmann-json maps std::pair and std::tuple to json-array.
Example:
When sending a jsonrpc request like {"jsonrpc":"2.0","id":1,"method":"method","params":{"x":0, "y":[1.0, 2.0, 3.0]}}
to a C++ method with signature bool method(const int x, const std::tuple<double, double, double>& y);
I get an error:
{"error":{"code":-32602,"message":"invalid parameter: must be object, but is array for parameter \"y\""},"id":1,"jsonrpc":"2.0"}
Adding this to typemapper.hpp to map std::tuples to json::value_t::array
Hi,
I'm having an issue where a function taking parameters of int, std::tuple<double, double, double> seems like it is getting detected as int, json-object instead of int, json-array.
nlohmann-json maps std::pair and std::tuple to json-array.
Example:
When sending a jsonrpc request like
{"jsonrpc":"2.0","id":1,"method":"method","params":{"x":0, "y":[1.0, 2.0, 3.0]}}
to a C++ method with signature
bool method(const int x, const std::tuple<double, double, double>& y);
I get an error:
{"error":{"code":-32602,"message":"invalid parameter: must be object, but is array for parameter \"y\""},"id":1,"jsonrpc":"2.0"}
Adding this to typemapper.hpp to map std::tuples to json::value_t::array
Seemed to work, and the call was accepted.
The text was updated successfully, but these errors were encountered: