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

1.3k Views Asked by At

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:

enter image description here

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

1

There are 1 best solutions below

0
errata On

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 Google Chrome

Mozilla Firefox Mozilla Firefox