Showing revision 1.1

JData

Universal Data Annotation and Interchange Format

Overview
N-D Arrays
C Complex
Sparse
Compressed
Tables
Trees
Graphs
Lists
Special Matrix

Overview

JData extends JSON/BJData with annotations to represent N-D arrays, sparse matrices, tables, trees, graphs, and more—all while remaining fully compatible with standard JSON parsers.

Key Features

  • Dual Format - Text (JSON) and binary (BJData)
  • Rich Types - uint8/16/32/64, int8/16/32/64, half/single/double
  • Complex Data - Arrays, tables, trees, graphs, lists
  • Compression - zlib, gzip support
  • Metadata - Inline and dedicated annotations
  • Portable - Works with any JSON parser
File Extensions: .jdt (text), .jdb (binary)
Spec Version: V1 Draft 3 • License: Apache 2.0
Scroll to explore

Data Storage

N-Dimensional Arrays

1-D Arrays
2-D Arrays
3-D Arrays
Complex
Sparse
Compressed
Upper Triangular
Lower Triangular
Band Matrix
Diagonal

1-D Arrays

Store vectors in row-major or column-major format:

% MATLAB (JSONLab) - Row vector
data = [1, 2, 3];
json_str = savejson('', data);
decoded = loadjson(json_str);

% Column vector
data = [1; 2; 3];
json_str = savejson('', data);

JSON Output:

// Row vector
[1, 2, 3]

// Column vector
[[1], [2], [3]]

Structured Data

Tables

Standard
Array of Structs
Struct of Arrays

Standard Table Format

Store tabular data with column headers and records:

{
  "_TableCols_": ["Name", "Age", "Degree", "Height"],
  "_TableRows_": [],
  "_TableRecords_": [
    ["Andy",    21, "BS", 69.2],
    ["William", 21, "MS", 71.0],
    ["Om",      22, "BS", 67.1]
  ]
}

Connected Data

Graphs & Trees

Graph (Edges)
Graph (Matrix)
Trees
Linked Lists

Graph with Edges

Represent graphs using nodes and edge lists:

{
  "_GraphNodes_": {
    "node1": data1,
    "node2": data2,
    "node3": data3,
    "node4": data4
  },
  "_GraphEdges_": [
    ["node1", "node2", edge_data_12],
    ["node2", "node3", edge_data_23],
    ["node1", "node4", edge_data_14]
  ]
}

Note: Edge data is optional. Use _GraphEdges0_ for undirected graphs.

Additional Features

Special Data Types

Constants
Enumerations
Maps
Byte Streams
Data Links

Special Constants

JData defines special values for edge cases:

{
  "nan_value": "_NaN_",
  "infinity": "+_Inf_",
  "neg_infinity": "-_Inf_",
  "null_value": null,
  "bool_value": true
}

Note: In binary JData, NaN/Inf are stored in IEEE 754 format.

Implementations

JData Parsers & Libraries

M MATLAB/Octave
Py Python
JS JavaScript
C++ C++
C C

MATLAB/Octave - JSONLab

The most comprehensive JData implementation with full support for all data types.

% Installation
git clone https://github.com/NeuroJSON/jsonlab.git
addpath('/path/to/jsonlab');

% Basic usage
data = struct('array', rand(10,20), 'name', 'test');
json_str = savejson('', data);
decoded = loadjson(json_str);

% Save to file
savejson('', data, 'FileName', 'output.json');

% Binary JData
savebj('', data, 'FileName', 'output.bjd');
data = loadbj('output.bjd');
Powered by Habitat