Showing revision 3.0

JSONlab: a toolbox to encode/decode JSON/UBJSON files in MATLAB/Octave


JSON (JavaScript Object Notation) is a highly portable, human-readable and "fat-free" text format to represent complex and hierarchical data. It is as powerful as XML, but less verbose. JSON format is widely used for data-exchange in applications, and is essential for the wild success of Ajax and Web2.0.

UBJSON (Universal Binary JSON) is a binary JSON format, specifically optimized for compact file size and better performance while keeping the semantics as simple as the text-based JSON format. Using the UBJSON format allows to wrap complex binary data in a flexible and extensible structure, making it possible to process complex and large dataset without accuracy loss due to text conversions.

We envision that both JSON and its binary version will serve as part of the mainstream data-exchange formats for scientific research in the future. It will provide the flexibility and generality achieved by other popular general-purpose file specifications, such as HDF5, with significantly reduced complexity and enhanced performance.

JSONlab is a free and open-source implementation of a JSON/UBJSON encoder and a decoder in the native MATLAB language. It can be used to convert a MATLAB data structure (array, struct, cell, struct array and cell array) into JSON/UBJSON formatted string, or decode a JSON/UBJSON file into MATLAB data. JSONlab supports both MATLAB and GNU Octave (a free MATLAB clone).

JSONlab was developed by Qianqian Fang at the Optics Division, Martinos Center for Biomedical Imaging, Massachusetts General Hospital/Harvard Medical School.

Learn Qianqian's other projects


  • JSON is a human-readable and self-explanatory format
  • JSON can represent arbitrarily complex datasets
  • JSON parsers for most languages are available for free
  • JSON data are web-friendly as it can be directly invoked (inline or load from remote site) in JavaScript

Share with the community Contribute to JSONlab Documentation and Release Notes Download JSONlab

What's New

  • [2013/08/23] JSONlab 1.0 Alpha is released! In this release, we added the long-waited Universal Binary JSON support to produce compact binary JSON files, which is potentially useful for many performance-sensitive applications. Please read the ChangeLog and download it from here.
  • [2012/12/18] JSONlab 0.9.1 is a stable release. Thanks to Niclas Borlin's fixes, jsonlab now has much better handling of empty and sparse matrices.
  • [2012/06/20] JSONlab 0.9.0 is here!. It has all the bug fixes and better loadjson-savejson round-trip consistency. Find details in ChangeLogs.
  • [2012/03/05] JSONlab 0.8.1 is ready for download. It features several bug fixes for proper handling of root-less objects and quotation marks. Read ChangeLogs for details.
  • [2012/01/13] JSONlab 0.8.0 (Sentinel) has arrived!. It contains major speed enhancements (20x) to loadjson for processing large data arrays, and several bug fixes. Please see ChangeLogs for more details. Get it from here.
  • [2011/10/21] JSONlab 0.5.1 (Nexus update 1) is available, fixing slow speed of loadjson and support JSON collection (a series of "{...}" enclosed JSON objects in a single file). See ChangeLogs.
  • [2011/10/16] First JSONlab release, 0.5 (Nexus), is ready for download.
  • [2011/10/10] First public announcement of the JSONlab project.
Powered by Habitat