[fpc-pascal] Null values with JSON RPC
Michael Van Canneyt
michael at freepascal.org
Fri Aug 7 14:58:06 CEST 2020
On Fri, 7 Aug 2020, Ryan Joseph via fpc-pascal wrote:
> I'm trying to get the pascal language server working on Visual Studio Code and during testing I found that sending null values to the server is causing problems. i.e.:
>
> ...
> "processId": 3997,
> "clientInfo": {
> "name": "vscode",
> "version": "1.47.3"
> },
> "rootPath": null,
> "rootUri": null,
> ...
>
> This is translated by the RPC layer to a message like:
>
> {"jsonrpc":"2.0","error":{"code":-32603,"message":"Cannot convert data from Null value"},"id":1}
>
> According to the protocol null values are allowed so is there a way I can
> accept null values gracefully instead of failing with an error? In
> particular rootPath is trying to be mapped to a string so it could be
> translated to just '' and that would be better than giving this error that
> prevents the server from working entirely and causes very confusing errors
> that are hard to debug.
By itself, fpJSON of course allows null values.
What are you using as a serialization technologgy ?
Michael.
More information about the fpc-pascal
mailing list