,"error":"json: cannot unmarshal object into Go value of type [1]interface {}

on: cannot unmarshal string into Go value of type [1]interface {}

使用jsonrpc的时候报以上两个错误,一个是因为

{
    "id": 1000,
    "method": "Arith.Divide",
    "params": "[{A:9,B:2}]"
}

一个是因为

{
    "id": 1000,
    "method": "Arith.Divide",
    "params": {
        "A": 9,
        "B": 2
    }
}

正确的应该是

{
    "id": 1000,
    "method": "Arith.Divide",
    "params": [{
        "A": 9,
        "B": 2
    }]
}

发布了397 篇原创文章 · 获赞 20 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/sun007700/article/details/104237268