Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON object GUI

I'd like to offer my users an interface to edit JSON objects.

For example I have a JavaScript that calls Google charts with the following options:

var options={
    chartType: "Pie",
    title:"Chart title",
    is3D:false,
    width:500,
    height:300,
};

Ideally my users should be able to modify the options themselves without having to look into the code. They would be presented with a UI automatically built from the object, where:

  • chartType is a select (Pie, Line, Bar)
  • title is a text input
  • is3D is a checkbox
  • etc.

Are there libraries for this? If not, any suggestion to get started?

I could of course build the form manually, but the idea is to have a generic solution that works for any object.

like image 292
Christophe Avatar asked Apr 18 '12 20:04

Christophe


People also ask

Is JSON a GUI?

JSON GUI is a tool for making even easier mock up a full REST API for your project. It's a GUI for json-server so you don't have to write JSON or generator functions to set up your API. Even though it's made for json-server, it can also be used as a JSON generator.

What is JSON and UI?

json format provides a schema to create a simple User Interface (UI) between geoh5py and Geoscience ANALYST Pro. The format uses JSON objects to represent script parameters used in the UI, and pass those parameters to an accompanying python script. Each ui.

What is a JSON object example?

JSON Object Example A JSON object contains data in the form of key/value pair. The keys are strings and the values are the JSON types. Keys and values are separated by colon. Each entry (key/value pair) is separated by comma.

What are JSON objects?

JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).


2 Answers

I found this link with conventions for describing JSON: http://www.json-schema.org/

Searching for "JSON schema" led me to a number of solutions, and in particular this post:

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

It was started two years ago, but is apparently well documented and kept up to date.

Also, a post from April 2012 on the ibm website:

http://www.ibm.com/developerworks/library/wa-jsonschema/index.html?cmp=dw&cpb=dwwdv&ct=dwnew&cr=dwnen&ccy=zz&csr=040512

like image 50
Christophe Avatar answered Oct 01 '22 07:10

Christophe


Problem

How to provide a user-friendly means of constructing arbitrary JSON structures where:

  • the user interface is intuitive, flexible and capable of use without developer-level technical proficiency
  • the user interface can be inferred from the structure of the JSON
  • modifications to the user interface require little or no developer intervention
  • modifications to the underlying JSON structure can automatically trigger modifications to the corresponding user interface

Solution

If this is the basic premise of the question, this approach does appear to be possible using any of various approaches under the "MVVM" nomenclature (which is apparently a variant of the "MVC" meme).

Examples

http://knockoutjs.com/examples/cartEditor.html http://en.wikipedia.org/wiki/Model_View_ViewModel#Open_source_MVVM_frameworks

See Also

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

like image 43
dreftymac Avatar answered Oct 01 '22 06:10

dreftymac