JSON Operations

Joseph Gentle edited this page Aug 22, 2013 · 18 revisions

Note: Operation reference moved here

OT for JSON allows multiple users to collaborate on arbitrary documents described by JSON. This document specifies what operations are valid and how those operations behave when multiple users are editing at the same time. If you want to know how to use JSON in ShareJS, see JSON Client API.

The document is stored by a plain JSON object. Documents can be passed initial data when they are created - but if not, they default to storing null.

Undefined is not a valid value anywhere in a JSON document.

The JSON OT code itself is in the share/ottypes project now.

To use the JSON type in ShareJS in the browser, you need to load the additional script file (json0.js). This file defines the JSON OT type for ShareJS. This additional include is not required from a node.js client.

There is a complicated multiplayer game written against the JSON OT stack in examples/hex.html. You can play it here.

Operations

Specifics about the operations themselves has been moved to the OT Types Wiki