JSPON

JavaScript Persistent Object Notation

About JSPON

JavaScript Persistent Object Notation (JSPON) is a convention for using JSON to facilitate JavaScript referencing and complex object types to provide the necessary semantics needed for efficient and meaningful persistent objects.

JSON provides a simple straightforward mechanism for serialization of objects that can efficiently and easily be read by humans and machines. JSON is adequate for the persistence of simple small objects. However, applications that have large complex object graphs and sets of data generally require the exchange of smaller subsets of the data/object graph to be transferred and persisted at a time rather than requiring an entire object graph to be treated as whole, as well as allow objects to be referred from multiple fiels. Such operations on subsets of data entail identifying objects within a graph and allowing for transfers of subsections of object graphs (and not just end point subsets). JSPON provides the common language so that objects can be passed with proper identification and reference information. This also allows objects to be referred to more than once (not possible within a normal JSON object graph).  Standard JSPON simply defines four fields (id, $ref, array, basis) that can be added to JSON objects to assist in data description.

Motivation

Object identification is necessary for any object that is referenced from multiple other objects to maintain correct referencing. This facilitates complex object graphs that have cyclic references as well as other forms of multiple objects referring to a single object. Another motivation for JSPON is that when dealing with large persisted object graphs, it is not feasible in terms of scalability to always download an entire object graph. If there are subsets of an object graph that are downloaded in different requests, it is necessary to use identification of objects to correctly reassemble the object graph.

If I have a large object database and I want to transfer an object that has several fields with pertinent information, but one of the fields references an object that references other objects in such a manner that downloading the entire object graph starting from the original object was several megabytes, it may be quite inefficient to transfer the entire object graph.  JSPON is intended to provide the means for marking objects as not loaded, but still identifiable so that non-leaf subsets of object graphs can be downloaded while maintaining the graph correctness and coherency so that data can reassembled across mutiple data transfers. This is a important ability for robust scalability.

Introduction to Format

The first three JSPON fields defined (id, $ref, array) are the core JSPON fields for referencing. They are the foundational fields for describing and transferring basic persistent objects.

The next field (basis) is a field to facilitate the definition of objects that inherit their properties from a prototype.

JSPON uses standard relative URIs derived from ids as a basis for requesting and putting JSPON objects.

Different parts of this format are necessary for different aspects of object persistence. Object identification is most important as it is necessary for multiple referencing, partial object graph transfer (for reassembly of graph subsets), and persistence (maintaining the identity of an object so that it can be reserialized back to the proper place in a database).  A ready flag is necessary for partial object graph transfer to identify objects that have not been fully transferred.  The array field allows array object to be identified, and other string keyed properties to be defined. The basis field allows inheritance.

Browser

You can try JSPON out with the reference JSPON browser .