Balancing Rock

Open Source Software

Arnhem, Netherlands

Contact

Warning: This software on this page is no longer supported

img

GUI

Overview

proJSON v1.3 is a full spectrum JSON editor that we intent to grow into a suite of JSON tools.

It supports the entire JSON specification as well as JSON fragments and multiple top level JSON objects (or fragments) in the same file.

It goes a step beyond ordinary JSON editors by associating properties with JSON items. Currently these properties can be used to define fonts and colors for the JSON items. Property files are maintained by proJSON in the properties library. Of course property files can also be managed by the user.

ProJSON will associate property files with JSON files based on either their filenames, the JSON filename and a regular expression (REGEX), or a path & key of an item inside the JSON hierarchy itself.

Main Features

  • Supports the JSON specification as defined in ECMA-404 (See http://json.org)
    • Duplicate naming of items in JSON Objects
    • Mixed types in an array
    • Fully reversible decoding/encoding (i.e. when reading and writing a JSON file the syntax is not changed)
  • Outline and free-flow editing
  • JSON fragments
  • Multiple JSON top level objects (or fragments) per file
  • Hierarchical font and color specification
  • Associate a properties file with a JSON file when the filenames names are equal
  • Associate a properties file with a JSON file based on the JSON filename and a properties file REGEX expression
  • Associate a properties file with a JSON file based on a path & key value of an item in the JSON file
  • Invalid JSON code will be opened in free-flow mode

Use

The editor is intuitive to use and as such does not really need a manual. However it is worth noting some aspects that are typical to the way proJSON works.

Path based properties

The first (and only) rule that a user should be aware of is that all properties are path based. Each JSON item that can be reached under the same path, will have the same properties.

Single or multiple JSON hierarchies per document

By default the editor starts up in single JSON hierarchy since this is the most common usage. In this mode the top level JSON object is not visible in the outline view, only its contents.

In multiple JSON hierarchies however the top level items are visible. Switching from multiple to single hierarchy is only possible if there is a single nameless JSON object at the top level.

Fragments

JSON fragments can only be displayed in multiple JSON hierarchies. A JSON fragment is a partial -but valid- JSON item. For example: 0 is a valid JSON NUMBER fragment. "Name":"Value" is a valid JSON STRING fragment. Etc.

File types (extensions)

proJSON opens files with the extension json and pro-json. A json file should contain one or more JSON hierarchies conform the definitions in the ECMA-404, or JSON fragments. If a JSON file has a different extension (like txt) then please change this extension to json before attempting to open it.

A pro-json file is formatted in the BRBON format. It is used for the properties of a JSON document, but it can also include the JSON code. The BRBON format is a binary format that cannot be read in a normal text editor.

Property files

proJSON will associate a document with a properties file. The association can be done in 3 ways:

  1. By filename. If a properties file exists in the properties library (or is opened at the same time as the JSON file) with the same name as the JSON file, then the properties in that file will be applied to the JSON file and that properties file wil be set as the read/write properties file belonging to the opened document.
  2. Using a regular expression (REGEX). All property files in the properties library are scanned to see if they contain REGEXs. When a JSON file is opened, and no filename match (see previous) can be made, then the REGEXs will be applied to the filename of the JSON file. The properties in the properties file with the first REGEX that matches exactly with the entire JSON filename will be applied to the JSON file. This property file will be set as the read-only properties file in the newly opened document.
  3. Using a path & key value. All property files in the properties library are scanned to see if they contain path/key specifications. When a JSON file is opened, and no filename match (see previous) can be made, and no REGEX matches with the filename, then the JSON file will be read and checked if a path/key value can be found in the JSON file that matches a predefined path/key in a properties file. Note that the key will be used as a regular expression applied to the string value of the JSON item. If found, then the properties in that properties file will be applied to the JSON file. This properties file will be set as the read-only properties file in the newly opened document.

Note: There is an “override” option for the path/key method that can be used to override a filename REGEX match.

Take the following example:

The properties library contains three properties specification files:

aaa.pro-json
	Which contains no REGEX or path/key combination
	
bbb.pro-json
	Which contains the REGEXs "a.*" and "d.*"
	
ccc.pro-json
	Which contains the path/key combination "customer.id : myname" with an override set to "true"

Then if a file is opened with the name bbb.json the properties from bbb.pro-json will be used.

If a JSON file named daa.json is opened then the properties in the file bbb.pro-json will be applied. Unless the JSON file contains an item: “customer”:{“id”:”myname”} in which case the properties file “ccc.pro-json” would be used.

Examples that can be parsed/created

The following contents are slightly more esoteric examples of complete JSON files that can be processed with proJSON.

A JSON number (fragment) without a name:

0

A named JSON string (fragment):

"name" : "John Smidt"

A named object (fragment):

"address" : { "city" : "New York", "street" : "Broadstreet", "number" : 1556 }

A dual hierarchy file (a JSON object and a JSON number fragment):

{}0

Multiple same-path booleans:

{
    "allow" : true,
    "allow" : false,
    "allow" : false
}

Mixed element types in an array (fragment):

[true, false, 12, "pro"]

Settings

The Settings screen contains settings that apply to the entire document. The document settings can be stored in the pro-json properties file associated with the document.

Read/Write Properties File: The file from which the properties were read and in which the properties will be stored. This file is set when opening the document or through selecting or saving a properties file. This field is for information only since the decision to save the properties (or not) is made by the user when the document is saved. Note that the properties can also be saved explicitly through the file-menu during editing.

If the document is a pro-json document this field does not appear.

Read Only Properties File: This file is set when properties have been applied without the intent to update the properties once the file is saved. This happens when a REGEX or path/key was used to select a properties file.

If the document is a pro-json document this field does not appear.

Note: The Read/Write and Read-Only properties file fields are mutually exclusive. At most one of these fields is used.

Remove button: If a properties file was manually selected (i.e. associated) for this document, the Remove button can be used to remove the association. This ensures that the associated properties file will not be updated when the document is saved.

If the document is a pro-json document this field does not appear.

Apply: Writes the changes to the document and close the sheet.

Cancel: Ignore any changes made and close the sheet.

Settings Default tab

Default Font: The default font and color used for all characters in the outline tab and print view. Note that this font will always be used for the JSON control characters like {}[],: and " in the print view. The text tab will always use a mono spaced font with the color black.

Name Font: The default font for all item names in the outline tab and print view. The text tab will always use a mono spaced font with the color black.

Value Font: The default font for all item values in the outline tab and print view. The text tab will always use a mono spaced font with the color black. Note that when a value contains other items, this font will be inherited by the sub items for both name and value. I.e. if the value of a JSON OBJECT is set to the color blue, then all items contained in the OBJECT will be blue for both name and value.

Properties Behaviour: The document can either use a single properties table for all JSON hierarchies in the document, or use a separate properties table for each JSON hierarchy. When switching from a multiple properties tables to a single properties table, only the properties set on the first JSON OBJECT or fragment will remain.

Settings File Mapping tab

This tab affects the association of the properties in this file with a newly opened JSON file. For any changes to take effect, the document must be saved.

Regular Expressions: These regular expressions will be applied to the filename of a JSON file that is opened to determine if the properties in this document must be applied to the JSON file. The regular expression must match the filename in its entirety. Example: the expression “A.*” will cause the properties in this document to be applied to all JSON files that start with an “A”. Note that the filename extension is not matched.

Path and Key: When a JSON file is opened, and contains a path/key combination that is entered in this table then the properties in this document will be applied to the JSON document that is opened. Note that the REGEX take precedence over Path/Key unless the “Override” checkbox is checked.

Save… & Save As…

In addition to the standard Save sheet, there are two additional options:

Format: By default the document will be stored in a standard JSON file and the properties in a properties file in the properties library. However it is possible to save the entire document (properties and JSON code) in a single pro-JSON file.

Keep in mind that the pro-JSON format is not compatible with other software packages and that it is a binary format that cannot be read in text editors.

Also Save/Update properties: When this checkbox is checked, the properties will be saved in a properties file stored in the properties directory irrespective of the format of the document (JSON code).

Open…

By default proJSON will try to find and load a properties file. If, however, the properties file should not be loaded it is possible to prevent this by clicking the Options button in the open dialogue and deselecting the checkbox button.

If a pro-JSON file is opened, the checkbox is disabled and ignored, the properties in the pro-JSON file will always be applied.

Associate Properties File…

This sheet allows the selection of a (new) associated properties file.

It contains two checkboxes which control how the properties will be affected, both in the document and in the selected properties file.

Clear current properties…: Before applying the properties from the new associated properties file clear the existing properties. This is the default behaviour.

Do not apply new properties: The document remains as is. Upon saving, the new associated properties file will reflect the properties of the current document.

Note 1: Any JSON code in the new properties file will be removed when saving the document.

Note 2: Any property in the new associated properties file that has no path in the current document will be removed automatically on saving.

This operation can be undone in the ‘Settings’ screen by removing the associated properties file.

Apply Properties File…

This sheet allows the selection of a file whose properties must be applied. The existing properties are not cleared, they remain as is unless overwritten by the applied properties.

Save Properties… & Save Properties As…

The Save Properties menu will save the properties currently visible in the document to the associated properties file. If there is no associated properties file it will open the Save Properties As… sheet.

The Save Properties As… sheet allows the creation of a new properties file in which all currently present document properties are stored. This file can be set as the associated properties file, but if the name of the new properties file is different than the name of the JSON file, it will not be loaded when the JSON file is opened.

Of course if the same name is chosen, then it will be associated with the JSON file if opened at the same time.

To create a new properties file in the library, simply save the JSON file, and confirm the creation of a properties file.

Properties Library

This menu entry will open the Properties Library. It will display the properties files that are present and the REGEX and Path/Key combination in these properties files. The window can be used to create new properties files or remove existing ones. It cannot be used to change REGEXs or Path/Keys, instead it will open the file itself to change these values.

End of document.