简体   繁体   中英

Output a URL with JSON into a readable format by passing it through another URL that can parse its data

I have a json url and I want o beautify it, but I don't want to install or setup any other software. Is there a online service where I can just pass this JSON url into and it will just spit out a beautified JSON output?

My JSON URL: https://testardor.jelurida.com/nxt?requestType=searchAssets&query=test

I want to be able to pass this URL into some type of 3rd party tool or online service like this:

www.xxxxxxx.com/?myjsonurl= https://testardor.jelurida.com/nxt?requestType=searchAssets&query=test

And the output should look something like this:

在此处输入图像描述

Currently everything requires a tool, but i want to see if i can just pass it through some type of 3rd party url.

If you are fine with using CLI, you can use simply curl to get your URL and pipe the response to service like jsonprettyprint . Something like this should work:

curl -s "https://testardor.jelurida.com/nxt?requestType=searchAssets&query=test" | curl -XPOST https://jsonprettyprint.org/api -d @-

-d @- part in the second curl will accept an argument from the pipe, which is your JSON response and the final output will look like this:

{
    "assets": [
        {
            "quantityQNT": "1",
            "accountRS": "ARDOR-VVT6-MZCJ-D5LM-GZBX6",
            "decimals": 0,
            "name": "test",
            "description": "test",
            "hasPhasingAssetControl": false,
            "asset": "9953675353702009791",
            "account": "16318018780553670436"
        },
        {
            "quantityQNT": "1000000",
            "accountRS": "ARDOR-7ZTK-DSYZ-8M9H-7ZXCL",
            "decimals": 2,
            "name": "test",
            "description": "test",
            "hasPhasingAssetControl": false,
            "asset": "18155981504089461142",
            "account": "6425439704861310769"
        },
        ....
    ]
}

If you would like to use browser for this purpose, both Firefox and Chrome (latest versions) and maybe even other browsers will prettify your JSON response, but you have to be sure that server responds with Content-type: application/json header (currently, your Content-type header is text/html ).

If the header is properly set (as it is in the example response on my screenshots below), you should see it pretty-printed already:

Google Chrome谷歌浏览器

Mozilla Firefox 火狐浏览器

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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