Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getpeerinfo returns a poorly-formatted JSON response in v2. #235

Closed
NotoriousPyro opened this issue Jan 23, 2018 · 1 comment
Closed

getpeerinfo returns a poorly-formatted JSON response in v2. #235

NotoriousPyro opened this issue Jan 23, 2018 · 1 comment

Comments

@NotoriousPyro
Copy link

NotoriousPyro commented Jan 23, 2018

Similarly to #225, #226 and #234

getpeerinfo returns an object, result, containing an object, peers, which is an array:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"getpeerinfo","params":[],"id":1}' http://127.0.0.1:8820/rpc/v2

{
        "id" : 1,
        "jsonrpc" : "2.0",
        "result" :
        {
                "peers" :
                [
                        "119.28.152.222:5251",
                        "47.88.76.112:5251",
                        "172.31.12.151:39154",
                        "172.31.12.151:5251",
                        "49.51.37.251:5251",
                        "138.68.15.134:5251",
                        "123.57.138.110:5251",
                        "49.51.40.205:5251",
                        "138.197.155.16:5251",
                        "49.51.40.128:5251"
                ]
        }
}

It would be easier to interface with the API with less chance of breakage if result was an array in this instance instead:

{
        "id" : 1,
        "jsonrpc" : "2.0",
        "result" :
        [
                "119.28.152.222:5251",
                "47.88.76.112:5251",
                "172.31.12.151:39154",
                "172.31.12.151:5251",
                "49.51.37.251:5251",
                "138.68.15.134:5251",
                "123.57.138.110:5251",
                "49.51.40.205:5251",
                "138.197.155.16:5251",
                "49.51.40.128:5251"
        ]
}
@NotoriousPyro NotoriousPyro changed the title getpeerinfo returns a poorly-formatted JSON repsonse in v2. getpeerinfo returns a poorly-formatted JSON response in v2. Feb 28, 2018
@luozhaohui
Copy link
Contributor

Fixed in APIv3 getpeerinfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants