json-rpc

JSON-RPC v2 response result: is bool a valid return type?


I'm trying to determine what are the valid types for the JSON-RPC v2 response result.

According to the specification:

result

This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.

This doesn't seem to specify what type of value the result will be.

The RPC client I am using only accepts object|array|string|int|null as the result type; why is bool not on that list? Is the client I am using wrong, or does the specification prohibit bool as a valid result type? (Or is there some other reason the result should not be a bool value?)


Solution

  • According to this discussion on the JSON-RPC mailing list:

    as per spec, it can be anything, including bool. also i don't know about PHP but js/json number type includes floating point numbers, not only integers. so if PHP makes a difference between int and, say, float/double, it should be there too