Kodi JSON-RPC over TCP 无效消息

Kodi JSON-RPC over TCP invalid message

我正在通过 tcp 套接字将此 json 发送到我的 raspi-kodi-client。

{"method":"Playlist.Clear","id":1,"jsonrpc":"2.0","params":[{"playlistid":1}]}

可是他returns我:

{"error":{"code":-32602,"data":{"method":"Playlist.Clear","stack":{"message":"Invalid type object received","name":"playlistid","type":"integer"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

为什么???看起来我太笨了哦,因为不同的例子看起来都一样

First Example - ok its http not tcp but I dont think thats the point - but maybe it is :O

我正在使用 kodi 1.7 和 openjdk 11。

在link的所有示例中,"params"是一个对象,而不是数组。而这个事实正是错误消息告诉你的(虽然我承认,它并没有说得很清楚)。

简单改变

{"method":"Playlist.Clear","id":1,"jsonrpc":"2.0","params":[{"playlistid":1}]}

{"method":"Playlist.Clear","id":1,"jsonrpc":"2.0","params":{"playlistid":1}}