重金买了个域名 json.cat
放着吃灰挺可惜 贡献给 xdm 了
期待有大神能来开发下 没广告就行
这是自己 2 行代码写的 主要突出一个快!
<body>
<main>
<textarea id="source" autofocus placeholder="Source"></textarea>
<textarea id="target" readonly placeholder="Format"></textarea>
</main>
</body>
<script>
const source = $("#source")
const target = $("#target")
source.keyup(() => {
try {
const text = source.val()
if (text.trim() == '') {
target.val("")
} else {
const json = JSON.parse(text)
const tree = JSON.stringify(json, null, '\t')
target.val(tree)
}
} catch (e) {
target.val(e.message)
}
})
</script>