繁体   English   中英

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

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

我有一个 json url 我想美化它,但我不想安装或设置任何其他软件。 Is there a online service where I can just pass this JSON url into and it will just spit out a beautified JSON output?

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

我希望能够将此 URL 传递到某种类型的 3rd 方工具或在线服务中,如下所示:

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

output 应该是这样的:

在此处输入图像描述

目前一切都需要一个工具,但我想看看我是否可以通过某种类型的第 3 方 url 传递它。

如果您可以使用 CLI,您可以简单地使用curl来获取 URL 和 pipe 对服务的响应,例如jsonprettyprint 像这样的东西应该工作:

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 ,您的Content-type header 是text/html )。

如果 header 设置正确(如下面截图中的示例响应所示),您应该已经看到它打印得很漂亮:

谷歌浏览器谷歌浏览器

Mozilla Firefox 火狐浏览器

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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