JsonRpcResponse payload 'must only contain arrays and scalar values'
It looks incorrect because of json encoding/decoding at php side.
I can arrange with my RPC-api clients, that API will return structure like:
{
"messages":[], // empty array
"context":[] // empty array too! But clients will await empty object from me.
}
So, looks like with current assertion I can not return empty object which will cause problems for clients, written on languages with strict typing (golang/c/etc).
I think, best solution is to allow stdClasses, because they are natively mapping to json-objects i.e. empty objects in empty stdClass case.
For now there is a condition:
But if I'll will use only arrays and will want to return an empty object:
It will return me json:
So, looks like with current assertion I can not return empty object which will cause problems for clients, written on languages with strict typing (golang/c/etc).
I think, best solution is to allow stdClasses, because they are natively mapping to json-objects i.e. empty objects in empty stdClass case.