Install JSONlab

The installation of JSONLab is no different from installing any other MATLAB toolbox. You only need to download/unzip the JSONLab package to a folder, and add the folder's path to MATLAB/Octave's path list by using the following command:

addpath('/path/to/jsonlab');
If you want to add this path permanently, you can type pathtool, browse to the JSONLab root folder and add to the list, then click "Save". Then, run rehash in MATLAB, and type which savejson, if you see an output, that means JSONLab is installed for MATLAB/Octave.

If you use MATLAB in a shared environment such as a Linux server, the best way to add path is to type

mkdir ~/matlab/
nano ~/matlab/startup.m
and type addpath('/path/to/jsonlab') in this file, save and quit the editor. MATLAB will execute this file every time it starts. For Octave, the file you need to edit is ~/.octaverc, where ~ is your home directory.

To use the data compression features, please download the ZMat toolbox from https://github.com/NeuroJSON/zmat/releases/latest and follow the instruction to install ZMat first. The ZMat toolbox is required when compression is used on MATLAB running in the -nojvm mode or GNU Octave, or 'lzma/lzip/lz4/lz4hc' compression methods are specified. ZMat can also compress large arrays that MATLAB's Java-based compression API does not support.

1.1. Install JSONLab on Fedora 24 or later

JSONLab has been available as an official Fedora package since 2015. You may install it directly using the below command

sudo dnf install octave-jsonlab
To enable data compression/decompression, you need to install octave-zmat using

sudo dnf install octave-zmat
Then open Octave, and type pkg load jsonlab to enable jsonlab toolbox.

1.2. Install JSONLab on Debian

JSONLab is currently available on Debian Bullseye. To install, you may run

sudo apt-get install octave-jsonlab
One can alternatively install matlab-jsonlab if MATLAB is available.

1.3. Install JSONLab on Ubuntu

JSONLab is currently available on Ubuntu 21.04 or newer as package <span class="title-ref">octave-jsonlab</span>. To install, you may run

sudo apt-get install octave-jsonlab
For older Ubuntu releases, one can add the below PPA

https://launchpad.net/~fangq/+archive/ubuntu/ppa

To install, please run

sudo add-apt-repository ppa:fangq/ppa
sudo apt-get update
to add this PPA, and then use

sudo apt-get install octave-jsonlab
to install the toolbox. octave-zmat will be automatically installed.

1.4. Install JSONLab on Arch Linux

JSONLab is also available on Arch Linux. You may install it using the below command

sudo pikaur -S jsonlab
Powered by Habitat