JSONio

JSON library for MATLAB

JSONio: a MATLAB JSON library

JSONio is a MATLAB library to read/write data in the JSON (JavaScript Object Notation) data-interchange format.

  • Download: JSONio.zip
  • Source code repository: GitHub.
  • License: MIT.
  • Installation: See instructions below.
  • Demo: See the example below.

JSON parsing uses Serge Zaitsev's excellent jsmn JSON fast parser.

JSONio is compatible with MathWorks' jsonencode/jsondecode, is faster than JSONlab, does not rely on Java like Matlab JSON and is easier to build than matlab-json.

This library is also part of SPM.

Installation

Unpack the archive and add the output folder to the MATLAB path.

A compiled MEX file is provided for all 64 bit platforms.

Example

>> json = jsonread('example.json')
json = 

  struct with fields:

       Width: 800
      Height: 600
       Title: 'View from the 15th Floor'
    Animated: 0
         IDs: [4x1 double]
>> jsonwrite(json)
ans =

  1x125 char array

{
  "Width": 800,
  "Height": 600,
  "Title": "View from the 15th Floor",
  "Animated": false,
  "IDs": [116,943,234,38793]
}