通过TCP无效消息的Kodi JSON-RPC

时间:2018-11-06 12:16:56

标签: java json kodi

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

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

但是他还给我:

{"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。

1 个答案:

答案 0 :(得分:1)

在该链接的所有示例中,“参数”是一个对象,而不是一个 array 。这个事实正是错误消息告诉您的(尽管我承认,但说的不是很清楚)。

只需更改

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

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