Data Sharing Format

 

When a folder is uploaded and downloaded, it’s encoded. ND1 uses JSON (JavaScript Object Notation) for encoding.

This section discusses the data structure of a folder and its individual data entries.

Overview

(c) 2010 Naive Design. All rights reserved.

While it is possible to edit or generate compliant import data using a text editor, we recommend that you use a JSON writer for automated generation, and a proper JSON editor for editing.

A free, working editor is Thomas Frank’s JSON Editor at http://www.thomasfrank.se/json_editor.html.


JSON Editor

The JSON data for a folder follows the structure of the following example:


{

"overview":"Utility Functions",

"data":[{"name":"cwd",

"data":"function() {\n\treturn calculator.functions.string.toString(calculator.currentDataCategory); }",

"comment":"The current folder"},

{"name":"funcs",

"data":"http://naivedesign.com/ND1/ND1_Reference__Functions.html",

"comment":"ND1 functions doc"},

{"name":"googleFor",

"data":"http://www.google.com/m/search?q=$$",

"comment":"arg: string to google for"},

{"name":"mat",

"data":"[[{\"type\":\"bignum\",\"needsRevival\":true,\"stringValue\":\"89\"},{\"type\":\"bignum\",\"needsRevival\":true,\"stringValue\":\"36\"}],[{\"type\":\"bignum\",\"needsRevival\":true,\"stringValue\":\"56\"},{\"type\":\"bignum\",\"needsRevival\":true,\"stringValue\":\"3\"}]]",

"comment":""},

{"name":"obj",

"data":{"type":"bigfloat", "stringValue":"3.141592653589793238462643383279"},

"comment":null}],

"notes":"@author Naive Design\n@version 1.0\n@copyright 2010 Naive Design\n@description Calculator-related tools\n@okToBundle no",

"uploadDate":"2010-05-31 20:52:38 +0200",

"downloadDate":"2010-05-30 14:25:41 +0200"

}


The overview property is a folder’s “Description” string.

The data property is an array holding the folder entries.

The notes property is the text that appears under “Credits & Notes”. It may contain @xxx markers as specified in Data Sharing.

UploadDate and downloadDate are strings containing ISO-compliant formatted dates.


For each array member in data, three properties need to be defined:

name is a string containing the name of the datum.

data is the contents of the datum. This is either a string or an object. (See the last example entry for an object.) Arrays are currently packed as strings so as not to create an unmanageable number of entries in an editor. (See the second to last example entry, which is a matrix encoding bignum objects.)

comment is a string containing the comment text of the datum. It can be “” or null.


The text encoding of the entire data is UTF-8.


Note, that the folder name is not part of this structure. Also note, that JSON formatting rules must be observed exactly. A concrete newline (vs. an one encoded as “\n”) appearing in string, an extra comma after the last entry in an array, or similar minor problems, will lead to an import failing with a “JSON data cannot be read” error.

JSON structure of a folder

pdf (6/2/10)http://naivedesign.com/docs/ND1_Reference_SharingFormat.pdf