jdorn / json-editor

JSON Schema Based Editor
MIT License
5.81k stars 1.08k forks source link

Read-only output #162

Open brettz9 opened 10 years ago

brettz9 commented 10 years ago

Although I know this is JSON Editor, I think it would be incredibly useful to be able to generate views out of JSON, guided by the schema and by your custom options/properties (e.g., utilizing format: "table" to generate a table). I am not looking for merely disabling form elements on an existing editor, but rather, intelligently displaying the content without extraneous controls, but with some minimal awareness of type (e.g., at least to support tables and provide classes for each type). A string with format: "url" could be displayed as a functional link, etc.

brettz9 commented 10 years ago

A singular advantage you'd have in a schema-aware read-only generator, especially (but not exclusively) for tables, that might not be obvious is that you could, for example, add controls which allowed type-aware filtering, e.g., providing:

  1. a range control for an integer type column to confine the table results (ideally in a bookmarkable manner).
  2. each cell of an integer column with its own ID and thus being made usable as a page anchor (I say cell instead of for the whole row, since anchors can be useful horizontally too). Bookmarking the anchor might be exposed to the user as well.
  3. String fields might allow highlighting and/or filtering by the equivalent of LIKE %...% searches in SQL with an optional checkbox to filter by regex.
  4. Date fields could expose filtering by date range
  5. Individual columns could be sortable by type, and hidden or reordered.
  6. Allow transposition of rows and columns, or placing specific column content interlinearly into other columns (e.g., two translations on top of each other) or with one column content available as tooltips on top of another.
  7. A form to provide full control of styles, for the table as a whole, or inline for individual columns, might be exposed to users for bookmarking a particular view of some tabularly-arranged text (e.g., display paragraphs 14-30, anchored at paragraph 16, in Zapf Chancery font, in a table with paragraph numbers added inline, without borders).

The above controls might be exposed at the top of columns and/or as a separate dialog (a separate dialog would also allow more intelligent filtering like combining AND/OR filters across columns, whereas the inline controls might assume AND filtering by default).

I think this approach using JSON Schema would be preferable to that of using one-off and mutually incompatible table editors.

I understand this may be well beyond the scope of your intended project, but I wanted to offer some ideas on possibilities given that I feel like there really needs to be a generic, type-aware way to display structured information, especially tabular, so that the likes of a type-aware wiki could be built with all manner of customization available on the view.

stanlemon commented 10 years ago

+1 this would be a great addition IMO.

crepererum commented 9 years ago

@jdorn would you accept a pull request which implements this functionality or do you think this is out of scope?

theyiwenliu commented 7 years ago

+1