JSON在线格式化 jsoneditor使用

Posted vivec

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSON在线格式化 jsoneditor使用相关的知识,希望对你有一定的参考价值。

 

    const placeholder = 
        string: ‘hello world!‘,
        boolean: true,
        color: ‘#6c928c‘,
        number: 123,
        null: null,
        array: [1, 2, 3],
        object: a: ‘b‘, c: ‘d‘, e: ‘f‘
    ;
    const json_editor = new JSONEditor(document.getElementById("json_editor"), mode: ‘code‘, placeholder);
    const tree_editor = new JSONEditor(document.getElementById("tree_editor"), null, placeholder);
    tree_editor.expandAll();

    function toTree() 
        tree_editor.set(JSON.parse(json_editor.getText()));
        tree_editor.expandAll();
    

    function toJson() 
        json_editor.setText(JSON.stringify(tree_editor.get(), null, 2))
    

  实现效果

~~~技术图片

在线DEMO(https://oktools.net/json)

以上是关于JSON在线格式化 jsoneditor使用的主要内容,如果未能解决你的问题,请参考以下文章

ultraedit怎么json解析

小工具

JSON相关 JSON在线解析 JSON压缩转义工具 JSON着色工具 JSON 在线格式化工具 在线XML/JSON互相转换工具 XMLJSON在线转换

如何在线把Excel表数据转json格式

JSON在线解析及格式化校验工具 jsonin.com

[工具]JSON校验转换在线工具