Is bool a valid type for the response object result?

373 views
Skip to first unread message

Patrick Kenny

unread,
Sep 21, 2024, 3:03:02 PM9/21/24
to JSON-RPC
I'm working on updating a Drupal module that uses JSON-RPC v2 in PHP and I'm trying to determine the valid types for the response object 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."


The function that parses the result expects it to be of type object|array|string|int|null.  Should bool also be on this list?  I'm trying to determine whether the type hint is incorrect (because it is missing bool), or if bool is not a permitted value for some reason.

Many thanks!

Rast lol

unread,
Sep 21, 2024, 3:22:54 PM9/21/24
to json...@googlegroups.com
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

--
You received this message because you are subscribed to the Google Groups "JSON-RPC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to json-rpc+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/json-rpc/b79bb924-778d-45b6-b79c-0d19fad55674n%40googlegroups.com.


--
— Rostislav `Rast` Kirillov
Reply all
Reply to author
Forward
0 new messages