简体   繁体   English

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

[英]Kodi JSON-RPC over TCP invalid message

I'm sending this json over a tcp-socket to my raspi-kodi-client. 我正在通过tcp套接字将此json发送到我的raspi-kodi-client。

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

But he returns me: 但他还给我:

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

Why??? 为什么??? It's look like I'm too stupidooo because diffrent examples looks same 看起来我太傻了,因为不同的例子看起来一样

First Example - ok its http not tcp but I dont think thats the point - but maybe it is :O 第一个例子-好吧,它的http不是tcp,但我认为那不是重点-但也许是:O

I'm using kodi 1.7 and openjdk 11. 我正在使用kodi 1.7和openjdk 11。

In all the examples in that link, "params" is an object , not an array . 在该链接的所有示例中,“ params”是一个对象 ,而不是一个array And that fact is exactly what the error message is telling you (although I admit, it's not saying it very clearly). 这个事实正是错误消息告诉您的(尽管我承认,但说的不是很清楚)。

Simply change 只需更改

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

to

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM