jsonwidget
An automatic form generator/editor for JSON
News:
The jsonwidget libraries
The jsonwidget libraries are a set of libraries for doing the following:
- Implementing a form interface for editing arbitrary JSON files.
- Validating JSON against a schema
- Other utility functions
Implementations so far:
- jsonwidget-python: A terminal window implementation suitable
for editing forms via ssh or in a local terminal window.
- jsonwidget-javascript: A client-side Javascript library generates a basic HTML form interface in
the browser
Application designers using these libraries have the option of providing
a schema, limiting the input to a subset of valid JSON compatible with whatever
application is actually consuming the JSON, or using a provided permissive
schema that allows any valid JSON. The libraries are capable of dynamically
generating a form is dynamically generated using nothing more than a schema
and a JSON file as input.
The libraries are licensed under a BSD-style license, making the licensing very flexible for many different applications.
jsonwidget-python
jsonwidget-python is a general-purpose JSON validation and manipulation
library. The following applications are bundled with jsonwidget-python:
- jsonedit - A terminal-based applications (like you would use via SSH
or local terminal on Linux and Mac). It's based on
urwid, an excellent Python-based library
for building terminal-based user interfaces.
- csvedit - A variation on jsonedit that allows editing of .csv/tsv files.
- jwc - a command line utility with the following functions:
- editserver - launch a web server to edit a json file from a browser
- json2yaml - convert a json file to yaml with comments pulled from schema (also yaml2json to go back)
- schemagen - create a schema from an example json file
- validate - validate a JSON file against a schema
Links:
jsonwidget-javascript
jsonwidget-javascript is a Javascript library that can be used to dynamically
build client-side forms to edit arbitrarily complicated JSON structures. As of 2010-04-13, this is incorporated into jsonwidget-python.
Demos
Note: these demos don't work well in IE, but seem fine in Firefox, Chrome and presumably Safari: (as of this writing on 2010-04-13):
Other demos are available via selection box at the bottom of the examples above.
Acknowledgements
This assembles a lot of code and ideas from other sources.
- json.js - a modified, outdated version of Douglas Crockford's library, which allows for nicely formated JSON. My apologies to Mr. Crockford for the butchered, forked version.
- Schema language inspired by and mostly compatible with the JSON version of Kwalify by Makoto Kuwata.
- JSON.php by Michal Migurski and others. This is provided as originally distributed.
- I'm certain there are others.
Mailing list
For help on using either of these, send mail to the jsonwidget@lists.robla.net mailing list. I don't anticipate much (any?) traffic here, but posting there is one way of getting my attention. Or just
contact me directly at robla@robla.net.
Copyright (c) 2005-2010 Rob Lanphier