File Exchange

image thumbnail

JSONLab

version 1.8.0.1 (60.9 KB) by Qianqian Fang
A toolbox to encode/decode JSON files in MATLAB/Octave

65 Downloads

Updated 19 Jul 2018

GitHub view license on GitHub

** JSONLAB v1.8 (Nominus - final) is released on 07/12/2018.**

URL: http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab
Github: https://github.com/fangq/jsonlab/

JSONlab is a component of the "iso2mesh" toolbox (http://iso2mesh.sf.net).

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 strings, or to decode a JSON/UBJSON file into MATLAB data structure. JSONlab supports both MATLAB and GNU Octave (a free MATLAB clone).

JSONlab provides two functions, loadjson.m -- a MATLAB->JSON decoder,
and savejson.m -- a MATLAB->JSON encoder, for the text-based JSON, and
two equivallent functions -- loadubjson and saveubjson for the binary
JSON. The savejson, loadubjson and saveubjson functions were written by
Qianqian Fang, while the loadjson.m script was derived from the previous works cited in the Acknowledgement section.

Please find detailed online help at http://iso2mesh.sourceforge.net/cgi-bin/index.cgi?jsonlab/Doc

Comments and Ratings (3)

Le Bai

Le Bai (view profile)

It works well when i load small json file, but when i load the big json file ''instances_train2017.json", Matlab works whole night and not completed, this file is about 460 megabytes in size, that small one is 9 Mb in size and completed takes about 1 min. Does anyone konw how to deal with this problem? Thanks.

Tago

Tago (view profile)

Excellent work

Hi Qianqian, thanks for the extremely useful toolbox! Here's a bug, though: In a Matlab array of strings which is a field in an array of structures, the "\" characters that are added as escape characters by savejson are not properly stripped off when you loadjson.

Updates

1.8.0.1

== JSONlab 1.8 (codename: Nominus - final) ==
- support strings object
- support MATLAB table objects
- fix octave warning for saveubjson
- avoid error in matlab 2017a, close #34
- added package.json
- added README.rst
- respect integer types

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor