我是新来的,但并不熟悉堆栈溢出。 ;)
我正在尝试对网络客户端进行JSON查询,但是我没有得到正确的Json查询。 手册说我应该发送以下信息:
{
"jsonrpc": "2.0",
"method": "property.get",
"id": 1,
"params": {
"property": "system.state"
}
}
但是我得到: 不需要id参数
{
"jsonrpc":"2.0",
"method":"property.get",
"params":[{
"property":"system.state"
}]
}
有人知道我如何获得正确的查询吗?这可能真的很简单, 下面是我的代码
Public Class JSONTESTClass
<JsonProperty(PropertyName:="jsonrpc")>
Public Property Index As String = "2.0"
<JsonProperty(PropertyName:="method")>
Public Property Method As String = "property.get"
<JsonProperty(PropertyName:="params")>
Public Property Test As List(Of PropertyClass)
End Class
Public Class PropertyClass
<JsonProperty(PropertyName:="property")>
Public Property something As String
End Class
Public Module mainModule
Sub Main()
Dim client As New JSONTESTClass With {
.Test = New List(Of PropertyClass)
}
client.Test.Add(New PropertyClass() With {.something = "system.state"})
Dim Send = JsonConvert.SerializeObject(projector)
Console.WriteLine(Send)
End Sub
End Module