Astn/JSON-RPC.NET

Result field is missing when function returns void

Astn opened this issue · 1 comments

Astn commented

// Pulled from a post at codeplex by Abaddon4 @ https://jsonrpc2.codeplex.com/discussions/654555
Hi!

Library return json object {"jsonrpc": "2.0", "id":1} if function return type is void. I think its wrong answer. The answer must be {"jsonrpc": "2.0", "id":1, "result":null} or {"jsonrpc": "2.0", "id":1, "result":{}}.

JSON RPC 2.0 standart:
result
This member is REQUIRED on success.

Either the result member or error member MUST be included, but both members MUST NOT be included.
So you can see that if function has no error then is successed, and it REQUIRED to have result. Please tell me if i wrong.

Astn commented

Thanks for reporting the issue! Makes sense to me. The one possible issue is that IIRC Json treats a null property as the same as a missing property. But I don't see any problems with trying to get that property to be present with a null value in this case.