jQuery 像属性浏览器一样工作的基于 GUI 或基于 Web 的 JSON 编辑器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/998832/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 10:22:13  来源:igfitidea点击:

GUI-based or Web-based JSON editor that works like property explorer

jqueryajaxjsoneditorwysiwyg

提问by dreftymac

Background:This is a request for something that may not exist yet, but I've been meaning to build one for a long time. First I will ask if anyone has seen anything like it yet.

背景:这是对可能尚不存在的东西的请求,但我很长时间以来一直想建立一个。首先我会问是否有人见过类似的东西。

Suppose you have an arbitrary JSON structure like the following:

假设您有一个任意的 JSON 结构,如下所示:

{
    'title_str':'My Employee List'
    ,'lastmod_str': '2009-June-15'
    ,'employee_table':[
        {'firstname':'john','lastname':'doe','age':'33',}
        ,{'firstname':'jane','lastname':'doe','age':'34',}
        ,{'firstname':'samuel','lastname':'doe','age':'35',}
    ]
}

Question:Is there a web-based JSON editor that could take a structure like this, and automatically allow the user to modify this in a user-friendly GUI?

问题:是否有基于 Web 的 JSON 编辑器可以采用这样的结构,并自动允许用户在用户友好的 GUI 中修改它?

Example:Imagine an auto-generated HTML form that displays 2 input-type-text controls for both title and lastmod, and a table of input-type-text controls with three columns and three rows for arr_list ... with the ability to delete or add additional rows by clicking on a [+][X] next to each row in the table.

示例:想象一个自动生成的 HTML 表单,它为 title 和 lastmod 显示 2 个 input-type-text 控件,以及一个包含三列三行的 input-type-text 控件表,用于 arr_list ... 具有删除功能或通过单击表格中每一行旁边的 [+][X] 添加其他行。

Big Idea:The "big idea" behind this is that the user would be able to specify any arbitrary (non-recursive) JSON structure and then also be able to edit the structure with a GUI-based interaction (this would be similar to the "XML Editor Grid View" in XML Spy).

大创意:这背后的“大创意”是用户将能够指定任何任意(非递归)JSON 结构,然后还能够使用基于 GUI 的交互来编辑结构(这将类似于XML Spy 中的“XML 编辑器网格视图”)。

See also:

也可以看看:

Update: (Thu 2014-07-31 18:31:11)

更新:(星期四 2014-07-31 18:31:11)

A github repository has been created to further track this closed SO post.

已创建 github 存储库以进一步跟踪此已关闭的 SO 帖子。

回答by dreftymac

Update:In an effort to answer my own question, here is what I've been able to uncover so far. If anyone else out there has something, I'd still be interested to find out more.

更新:为了回答我自己的问题,这是我迄今为止能够发现的。如果那里的其他人有什么,我仍然有兴趣了解更多信息。

Based on JSON Schema

基于 JSON Schema

Commercial (No endorsement intended or implied, may or may not meet requirement)

商业(无意或暗示背书,可能满足也可能不满足要求)

jQuery

jQuery

YAML

YAML

See Also

也可以看看

回答by Ether

Generally when I want to create a JSON or YAML string, I start out by building the Perl data structure, and then running a simple conversion on it. You could put a UI in front of the Perl data structure generation, e.g. a web form.

通常,当我想创建 JSON 或 YAML 字符串时,我首先构建 Perl 数据结构,然后对其进行简单的转换。您可以在 Perl 数据结构生成之前放置一个 UI,例如 Web 表单。

Converting a structure to JSON is very straightforward:

将结构转换为 JSON 非常简单:

use strict;
use warnings;
use JSON::Any;

my $data = { arbitrary structure in here };
my $json_handler = JSON::Any->new(utf8=>1);
my $json_string = $json_handler->objToJson($data);