tag:github.com,2008:https://github.com/NeuroJSON/jsonlab/releases Release notes from jsonlab 2024-03-28T19:43:53Z tag:github.com,2008:Repository/25124906/v2.9.8 2024-04-19T18:23:34Z JSONLab 2.9.8 (codename: Micronus Prime - beta) <p><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/87795ed66b59a443c1521904c715069448c8013f31fc92eb06d62239c201b74d/68747470733a2f2f6e6575726f6a736f6e2e6f72672f77696b692f75706c6f61642f6e6575726f6a736f6e5f62616e6e65725f6c6f6e672e706e67"><img src="https://camo.githubusercontent.com/87795ed66b59a443c1521904c715069448c8013f31fc92eb06d62239c201b74d/68747470733a2f2f6e6575726f6a736f6e2e6f72672f77696b692f75706c6f61642f6e6575726f6a736f6e5f62616e6e65725f6c6f6e672e706e67" alt="image" data-canonical-src="https://neurojson.org/wiki/upload/neurojson_banner_long.png" style="max-width: 100%;"></a></p> <h1>JSONLab - compact, portable, robust JSON/binary-JSON encoder/decoder for MATLAB/Octave</h1> <h2>Click <a href="https://neurojson.org/wiki/index.cgi?keywords=registration&amp;tool=jsonlab&amp;ref=github" rel="nofollow">here to register and download</a> JSONLab 2.9.8</h2> <h2>v2.9.8</h2> <ul> <li>Copyright (c) 2011-2024 Qianqian Fang &lt;q.fang at neu.edu&gt;</li> <li>License: BSD or GNU General Public License version 3 (GPL v3), see License*.txt</li> <li>Version: 2.9.8 (Micronus Prime - Beta)</li> <li>URL: <a href="https://neurojson.org/jsonlab" rel="nofollow">https://neurojson.org/jsonlab</a></li> <li>User forum: <a href="https://github.com/orgs/NeuroJSON/discussions/">https://github.com/orgs/NeuroJSON/discussions/</a></li> <li>Compatibility: MATLAB R2008 or newer, GNU Octave 3.8 or newer</li> <li>Acknowledgement: This project is supported by US National Institute<br> of Health (NIH) grant <a href="https://reporter.nih.gov/project-details/10308329" rel="nofollow">U24-NS124027</a></li> </ul> <h2>Compatible Specifications</h2> <ul> <li>JData Specification Version: <a href="https://neurojson.org/jdata/draft3" rel="nofollow">V1 Draft-3</a></li> <li>Binary JData Specification Version: <a href="https://neurojson.org/bjdata/draft2" rel="nofollow">V1 Draft-2</a></li> <li>JSON-Mmap Specification Version: <a href="https://neurojson.org/jsonmmap/draft1" rel="nofollow">V1 Draft-1</a></li> </ul> <h2>What's New</h2> <p>We are excited to announce that the JSONLab project, as the official reference library for both <a href="https://neurojson.org/jdata/draft3" rel="nofollow">JData</a> and <a href="https://neurojson.org/bjdata/draft2" rel="nofollow">BJData</a> specifications, has been funded by the US National Institute of Health (NIH) as part of the NeuroJSON project (<a href="https://neurojson.org" rel="nofollow">https://neurojson.org</a> and <a href="https://neurojson.io" rel="nofollow">https://neurojson.io</a>).</p> <p>The goal of the NeuroJSON project is to develop scalable, searchable, and reusable neuroimaging data formats and data sharing platforms. All data produced from the NeuroJSON project will be using JSON/Binary JData formats as the underlying serialization standards and the lightweight JData specification as language-independent data annotation standard, all of which have been evolved from the over a decade development of JSONLab.</p> <p>JSONLab v2.9.8 - code named "Micronus Prime - beta" - is the beta-release of the next milestone (v3.0), containing a number of key feature enhancements and bug fixes. The major new features include</p> <ol> <li>exporting JSON Memory-Map (<code>jsonget,jsonset</code>) for rapid disk-map like reading/writing of JSON/binary JSON files and streams, implementing <a href="https://github.com/NeuroJSON/jsonmmap">JSON-Mmap spec v1 Draft 1</a></li> <li>supporting JSONPath query (<code>jsonpath</code>) to MATLAB data and JSON/binary JSON file and streams, including deep-scan operators,</li> <li>(<strong>breaking</strong>) upgrading the supported BJData spec to <a href="https://neurojson.org/bjdata/draft2" rel="nofollow">V1 Draft 2</a> where the default numerical data byte order changed from Big-Endian to <strong>Little-Endian</strong>,</li> <li>adding initial support to JData <a href="https://github.com/NeuroJSON/jdata/blob/master/JData_specification.md#data-referencing-and-links"><code>_DataLink_</code></a> decoding to link multiple JSON/binary JSON files</li> <li>dynamically cache linked data files (<code>jsoncache</code>, <code>jdlink</code>) to permit on-demand download and processing of complex JSON-encoded datasets such as neuroimaging datasets hosted on <a href="https://neurojson.io" rel="nofollow">https://neurojson.io</a></li> <li>support high-performance Blosc2 meta-compressor for storing large N-D array data,</li> <li><code>savejson/loadjson</code> can use MATLAB/Octave built-in <code>jsonencode/jsondecode</code> using the <code>BuiltinJSON</code> option</li> <li>automatically switch from <code>struct</code> to <code>containers.Map</code> when encoded key-length exceeds 63</li> <li>provide fall-back zlib/gzip compression/decompression function (<code>octavezmat</code>) on Octave when ZMat is not installed</li> <li>include built-in <code>.nii/.nii.gz/.jnii/.h5/.snirf/.tsv/.csv</code> parsers to allow loadjd.m to read wide range of files</li> <li>include <code>json2couch</code> from jbids (<a href="https://github.com/NeuroJSON/jbids">https://github.com/NeuroJSON/jbids</a>) to allow uploading json files to CouchDB server</li> </ol> <p>There have been many major updates added to this release since the previous release v2.0 in June 2020. A list of the major changes are summarized below (with key features marked by *), including the support to BJData Draft-2 specification, new interface functions <code>savejd/loadjd</code>, and options to use MATLAB/Octave built-in <code>jsonencode/jsondecode</code> functions. The <code>octave-jsonlab</code> package has also been included in the official distributions of Debian Bullseye and Ubuntu 21.04 or newer.</p> <ul> <li>2024-03-28 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b39c374cddfb7066a5252875852ea187c046e069/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b39c374cddfb7066a5252875852ea187c046e069"><tt>b39c374</tt></a>] [feat] add json2couch from jbids toolbox</li> <li>2024-03-27*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e4358648720de52f3f38446bc5fdcdfdbeef2d7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e4358648720de52f3f38446bc5fdcdfdbeef2d7"><tt>2e43586</tt></a>] [feat] merge <code>nii/jnii/hdf5/tsv</code> reading functions self-contained</li> <li>2024-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b482c8f0a4055925f5303da7b39fd0b03c428b70/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b482c8f0a4055925f5303da7b39fd0b03c428b70"><tt>b482c8f</tt></a>] [test] pass all tests on matlab R2010b</li> <li>2024-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2008934cbc8810bbc25c4af04473549373095eae/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2008934cbc8810bbc25c4af04473549373095eae"><tt>2008934</tt></a>] [doc] additional documentations on decompression functions</li> <li>2024-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0a582fb211aead1fbd9ae6f20c6d894f3ef5d231/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0a582fb211aead1fbd9ae6f20c6d894f3ef5d231"><tt>0a582fb</tt></a>] [doc] add documentations for jsonpath, jsoncache, jdlink, and maxlinklevel</li> <li>2024-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5dba1defe133c4350f6acce2c6bfcddd73f0839c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5dba1defe133c4350f6acce2c6bfcddd73f0839c"><tt>5dba1de</tt></a>] [bug] <code>..</code> searches deep level of struct, make jdlink work for Octave 4.2 and 5.2</li> <li>2024-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/fea481eac8b8645ec89524945caded43bd1088b4/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/fea481eac8b8645ec89524945caded43bd1088b4"><tt>fea481e</tt></a>] [doc] add line-by-line comment on examples, add <code>jsonset/jsonget</code></li> <li>2024-03-26 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e1d386d9dd7c1d2d612f9cedb8f14cd420ff41b2/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e1d386d9dd7c1d2d612f9cedb8f14cd420ff41b2"><tt>e1d386d</tt></a>] [feat] support saving dictionary to json and bjdata</li> <li>2024-03-26 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/dfc744b419a496b2814baa11d6ceeb456bc30878/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/dfc744b419a496b2814baa11d6ceeb456bc30878"><tt>dfc744b</tt></a>] [feat] support caching data from any URL using hash, add <code>NO_ZMAT</code> flag</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/22d297e5e01e93bf062fe848e87275819b1a21f9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/22d297e5e01e93bf062fe848e87275819b1a21f9"><tt>22d297e</tt></a>] [doc] fix README.rst formatting issues</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/7e27db558a2fc563afbae8b5c021885478fde400/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/7e27db558a2fc563afbae8b5c021885478fde400"><tt>7e27db5</tt></a>] [doc] update documentation, preparing for v2.9.8 release</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/1227a0b9be444723192e6209d2f840bd788a27dc/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/1227a0b9be444723192e6209d2f840bd788a27dc"><tt>1227a0b</tt></a>] [format] reformat</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/67f30cab3d366015513fe623868e8304a847aec7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/67f30cab3d366015513fe623868e8304a847aec7"><tt>67f30ca</tt></a>] [feat] support using . or [] in JSONPath to escape dots in key names</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ee830cda9b2d151a1bae0049f935754cdec33a93/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ee830cda9b2d151a1bae0049f935754cdec33a93"><tt>ee830cd</tt></a>] [bug] fix error_pos error when giving a non-existant input file</li> <li>2024-03-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d69686dedaafabb5dcddb173dd4cb8ec9ba580a1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d69686dedaafabb5dcddb173dd4cb8ec9ba580a1"><tt>d69686d</tt></a>] [feat] add jdlink to dynamically download and cache linked data</li> <li>2024-03-22 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/772a1ef9a1989fa7b33953fa863391c9b6d9cf48/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/772a1ef9a1989fa7b33953fa863391c9b6d9cf48"><tt>772a1ef</tt></a>] [ci] fix octave failed test</li> <li>2024-03-22*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/cff529a7b89a40a2fecb2ed8ad3903e2d8ee85f6/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/cff529a7b89a40a2fecb2ed8ad3903e2d8ee85f6"><tt>cff529a</tt></a>] [test] add jsonpath test, refine jsonpath syntax support</li> <li>2024-03-22 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/22435e4eb6aff03d96e90ece766d7a77f4a6a8a8/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/22435e4eb6aff03d96e90ece766d7a77f4a6a8a8"><tt>22435e4</tt></a>] [bug] fix jsonpath handling of recursive deep scans</li> <li>2024-03-21 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c9f8a20a276ee53642dcda9634918089312e8fa6/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c9f8a20a276ee53642dcda9634918089312e8fa6"><tt>c9f8a20</tt></a>] [bug] support deep scan in cell and struct, merge struct/containers.Map</li> <li>2024-03-21 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/394394a099b585a313d350ff80a45b6f85911fa3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/394394a099b585a313d350ff80a45b6f85911fa3"><tt>394394a</tt></a>] [bug] improve jsonpath cell with deep scan</li> <li>2024-03-20 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a599e71055f0cb3b3bddac6a8562a5df452736a3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a599e71055f0cb3b3bddac6a8562a5df452736a3"><tt>a599e71</tt></a>] [feat] add jsoncache to handle <code>_DataLink_</code> download cache, rename jsonpath</li> <li>2024-02-19*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4f2edebee39fb750a597557bd31d4d2fc5494241/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4f2edebee39fb750a597557bd31d4d2fc5494241"><tt>4f2edeb</tt></a>] [feat] support .. jsonpath operator for deep scan</li> <li>2024-01-11 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c43a758a01f56c7d7448f01620ed2f0d03a42299/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c43a758a01f56c7d7448f01620ed2f0d03a42299"><tt>c43a758</tt></a>] [bug] fix missing index_esc reset, add test for automap</li> <li>2024-01-11*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ef5b472d573d85f816b40cdc7308f54194c3bfe4/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ef5b472d573d85f816b40cdc7308f54194c3bfe4"><tt>ef5b472</tt></a>] [feat] automatically switch to map object when key length &gt; 63</li> <li>2023-11-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ee241228c5c7c694b668bffd96ef037db1e14e97/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ee241228c5c7c694b668bffd96ef037db1e14e97"><tt>ee24122</tt></a>] use sprintf to replace unescapejsonstring</li> <li>2023-11-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/abe504fab4607d66d2d44d69a266e4529e564588/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/abe504fab4607d66d2d44d69a266e4529e564588"><tt>abe504f</tt></a>] [ci] test again on macos-12</li> <li>2023-11-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d2ff26ab8f5fef8ccf63cace9e747f9f2dee1029/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d2ff26ab8f5fef8ccf63cace9e747f9f2dee1029"><tt>d2ff26a</tt></a>] [ci] install octave via conda on macos to avoid hanged install</li> <li>2023-11-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/33263de3b020714a60daba1ce54f480879bc2365/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/33263de3b020714a60daba1ce54f480879bc2365"><tt>33263de</tt></a>] completely reformat m-files using miss_hit</li> <li>2023-11-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3ff781f3bea71f8eb129523ea2a724f22f1ecfb1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3ff781f3bea71f8eb129523ea2a724f22f1ecfb1"><tt>3ff781f</tt></a>] make octavezmat work on matlab</li> <li>2023-10-29 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ea4a4fd478dee960e5719cbe8246fd09cdd5e2ee/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ea4a4fd478dee960e5719cbe8246fd09cdd5e2ee"><tt>ea4a4fd</tt></a>] make test script run on MATLAB R2010b</li> <li>2023-10-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ca91e07ef620dd81725f5b60442c2692b8287b22/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ca91e07ef620dd81725f5b60442c2692b8287b22"><tt>ca91e07</tt></a>] use older matlab due to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1920936813" data-permission-text="Title is private" data-url="https://github.com/matlab-actions/run-command/issues/43" data-hovercard-type="issue" data-hovercard-url="/matlab-actions/run-command/issues/43/hovercard" href="https://github.com/matlab-actions/run-command/issues/43">matlab-actions/run-command#43</a></li> <li>2023-10-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4bf823280b2dae588b2d5d97bacdbe356920e6be/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4bf823280b2dae588b2d5d97bacdbe356920e6be"><tt>4bf8232</tt></a>] add NO_ZMAT flag, fix fread issue</li> <li>2023-10-27*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ce3c0a0141f66f6a837090a21ef95454394fe9ed/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ce3c0a0141f66f6a837090a21ef95454394fe9ed"><tt>ce3c0a0</tt></a>] add fallback zlib/glib support on Octave via file-based zip/unzip</li> <li>2023-10-26 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/7ab1b6ed8b9375428f0a7599c98fa310a4deb04c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/7ab1b6ed8b9375428f0a7599c98fa310a4deb04c"><tt>7ab1b6e</tt></a>] fix error for expecting an ending object mark when count is given</li> <li>2023-09-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6dfa58eb9c11766de0bf22ca376bdd9d3dff5b2c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6dfa58eb9c11766de0bf22ca376bdd9d3dff5b2c"><tt>6dfa58e</tt></a>] Fix typos found by codespell</li> <li>2023-06-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/7d7e7f77e9754721146fe90f7ece1b910c3e0bc7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/7d7e7f77e9754721146fe90f7ece1b910c3e0bc7"><tt>7d7e7f7</tt></a>] fix typo of compression method</li> <li>2023-06-27*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c25dd0ff896cee54adca99b790bcd3723753b418/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c25dd0ff896cee54adca99b790bcd3723753b418"><tt>c25dd0f</tt></a>] support blosc2 codecs in save and load data, upgrade jsave/jload</li> <li>2023-06-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b23181a49cbf596730fba2b8c963f07c22d3c903/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b23181a49cbf596730fba2b8c963f07c22d3c903"><tt>b23181a</tt></a>] test root-level indentation</li> <li>2023-06-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5bfde65bb86d2102db64525f7d569bc4a7e4eb0b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5bfde65bb86d2102db64525f7d569bc4a7e4eb0b"><tt>5bfde65</tt></a>] add indentation test</li> <li>2023-06-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b2678586c081ce9a38edc62540ea73b2aff2d40b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b2678586c081ce9a38edc62540ea73b2aff2d40b"><tt>b267858</tt></a>] fix CI errors related to octave utf-8 handling</li> <li>2023-06-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/1e93d075ebf912ee1fef803b9f401b7c61109ee8/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/1e93d075ebf912ee1fef803b9f401b7c61109ee8"><tt>1e93d07</tt></a>] avoid octave 6.4+ regexp non-utf8 error see discussions at octave bug thread: <a href="https://savannah.gnu.org/bugs/index.php?57107" rel="nofollow">https://savannah.gnu.org/bugs/index.php?57107</a></li> <li>2023-06-15 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8f921ac77e7d088fdc0aa2ce39ef1323f4660540/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8f921ac77e7d088fdc0aa2ce39ef1323f4660540"><tt>8f921ac</tt></a>] fix broken tests</li> <li>2023-06-11*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6cb5f126c4a91b650ebbe1c28d2863e61627c8e7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6cb5f126c4a91b650ebbe1c28d2863e61627c8e7"><tt>6cb5f12</tt></a>] allow linking binary jdata files inside json</li> <li>2023-06-10 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2d0649bd2c50994ef2b23a0f6071b99f68e014dd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2d0649bd2c50994ef2b23a0f6071b99f68e014dd"><tt>2d0649b</tt></a>] do not compress long string by default, read bjd from URI</li> <li>2023-06-10 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5135dea669380f1a56231b3e480b4441140e38ce/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5135dea669380f1a56231b3e480b4441140e38ce"><tt>5135dea</tt></a>] saving JSON with UTF-8 encoding, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="749563079" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/71" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/71/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/71">#71</a></li> <li>2023-06-10*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a3c807fbb46ca92d1c53d41cd6dda6a0ebaabd88/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a3c807fbb46ca92d1c53d41cd6dda6a0ebaabd88"><tt>a3c807f</tt></a>] add zstdencode and zstddecode via new version of zmat</li> <li>2023-06-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/837c8b541f765081185bce637e78d9c27e47d7f3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/837c8b541f765081185bce637e78d9c27e47d7f3"><tt>837c8b5</tt></a>] fix containers.Map indentiation bug with a single element</li> <li>2023-06-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/747c99b5d434ce9f90097ddc0ad98bf1d5d45964/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/747c99b5d434ce9f90097ddc0ad98bf1d5d45964"><tt>747c99b</tt></a>] fix string indentation, add option EmptyArrayAsNull, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1744695662" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/91" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/91/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/91">#91</a></li> <li>2023-06-05*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/cf573262eb12c1d1dc3668913c1f902e3452f566/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/cf573262eb12c1d1dc3668913c1f902e3452f566"><tt>cf57326</tt></a>] support blosc2 meta compressors</li> <li>2023-05-05 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d37a38605b970dda6790756d81919a08a06dec56/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d37a38605b970dda6790756d81919a08a06dec56"><tt>d37a386</tt></a>] use {:} to expand varargin</li> <li>2023-04-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/03311d2ce81e592afaf2d3c3136f1524a27959c2/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/03311d2ce81e592afaf2d3c3136f1524a27959c2"><tt>03311d2</tt></a>] remove README.txt, no longer used, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1679401593" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/88" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/88/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/88">#88</a></li> <li>2023-04-21 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/49eceb0f8ce81dbb3ee34953f9e1b9ffd8a418b0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/49eceb0f8ce81dbb3ee34953f9e1b9ffd8a418b0"><tt>49eceb0</tt></a>] Fix typo not found by codespell</li> <li>2023-04-21 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/75b1fdc118d3199536f291af98514c82680eb10a/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/75b1fdc118d3199536f291af98514c82680eb10a"><tt>75b1fdc</tt></a>] Fix typos found by codespell</li> <li>2023-04-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8fea393dd98b91d25b44e131bfff3b8ce5f0d52e/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8fea393dd98b91d25b44e131bfff3b8ce5f0d52e"><tt>8fea393</tt></a>] revert savejson change</li> <li>2023-04-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9554a440528fa1cef10a3399ec2ee46b4882a72f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9554a440528fa1cef10a3399ec2ee46b4882a72f"><tt>9554a44</tt></a>] Merge branch 'master' of github.com:fangq/jsonlab</li> <li>2023-04-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3c32aff4b40304f4b0e535276cb2324aabcf7237/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3c32aff4b40304f4b0e535276cb2324aabcf7237"><tt>3c32aff</tt></a>] speed up string encoding and decoding</li> <li>2023-04-09*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8c8464f50183da4a817dc8220be406c485b2334f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8c8464f50183da4a817dc8220be406c485b2334f"><tt>8c8464f</tt></a>] rename jamm files to pmat - portable mat, will add jsonmmap</li> <li>2023-04-09 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/aa1c2a4a7a3f618743ee579ebddc1b3b92a7c4d9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/aa1c2a4a7a3f618743ee579ebddc1b3b92a7c4d9"><tt>aa1c2a4</tt></a>] drop ubuntu-18.04</li> <li>2023-04-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9173525b0ae7bc414567653440d7f9a56758f2fb/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9173525b0ae7bc414567653440d7f9a56758f2fb"><tt>9173525</tt></a>] replace regexp to ismember due to octave bug 57107; test mac</li> <li>2023-04-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/67065dcb3b20da6b9d34c73e565a97df6a09f0f7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/67065dcb3b20da6b9d34c73e565a97df6a09f0f7"><tt>67065dc</tt></a>] fix matlab test</li> <li>2023-04-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8dcedad4147ac38106c185f940b6679d2486ec75/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8dcedad4147ac38106c185f940b6679d2486ec75"><tt>8dcedad</tt></a>] use alternative test to avoid octave bug 57107</li> <li>2023-04-08*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9b6be7b8b21bfb3ded2b6e6cf190a75c6a633d17/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9b6be7b8b21bfb3ded2b6e6cf190a75c6a633d17"><tt>9b6be7b</tt></a>] add github action based tests</li> <li>2023-02-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/cb43ed1655021f8d08844ce3a3613916abc62e2d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/cb43ed1655021f8d08844ce3a3613916abc62e2d"><tt>cb43ed1</tt></a>] add bug fix test section</li> <li>2023-02-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2412ebf2c4ae12d2f204973a3291e79a90484b77/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2412ebf2c4ae12d2f204973a3291e79a90484b77"><tt>2412ebf</tt></a>] only simplify all-numeric or all-struct cells</li> <li>2023-02-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d4e77e1f472c2e1abde2a2aea1fce960ee9b6bd1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d4e77e1f472c2e1abde2a2aea1fce960ee9b6bd1"><tt>d4e77e1</tt></a>] add missing file extension</li> <li>2023-02-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/408cc2e0d47cd75d641a5250c637eb5f7eb5e09e/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/408cc2e0d47cd75d641a5250c637eb5f7eb5e09e"><tt>408cc2e</tt></a>] fix loadjd and savejd file extension match, add jbids</li> <li>2023-02-22 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/29bac9d839d7a11ba45d5b9727f294eb7ae8f80f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/29bac9d839d7a11ba45d5b9727f294eb7ae8f80f"><tt>29bac9d</tt></a>] fix broken jdatahash</li> <li>2023-02-22*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/69a7d015643cb9fddc7902a184c53e8e7a17b5ec/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/69a7d015643cb9fddc7902a184c53e8e7a17b5ec"><tt>69a7d01</tt></a>] add a portable data hash function</li> <li>2023-02-09 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0448eb1ead7978cb90d2d251fd25f9f3652858b4/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0448eb1ead7978cb90d2d251fd25f9f3652858b4"><tt>0448eb1</tt></a>] preventing matlab 2022b converting string to unicode</li> <li>2022-11-21 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9ce91fc8959fe0589a8c6e4d34f5711be41d46d3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9ce91fc8959fe0589a8c6e4d34f5711be41d46d3"><tt>9ce91fc</tt></a>] handle empty struct with names, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1457251336" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/85" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/85/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/85">#85</a></li> <li>2022-11-20 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9687d17af718af0fcc6d36beb101ef2842815ba5/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9687d17af718af0fcc6d36beb101ef2842815ba5"><tt>9687d17</tt></a>] accept string typed file name, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1457072427" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/84" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/84/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/84">#84</a></li> <li>2022-08-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/283e5f19e273b583dd0622cc372b87eeae17c2a0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/283e5f19e273b583dd0622cc372b87eeae17c2a0"><tt>283e5f1</tt></a>] output data depends on nargout</li> <li>2022-08-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c729048c751f3df1775b4f8e931895f0febe619d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c729048c751f3df1775b4f8e931895f0febe619d"><tt>c729048</tt></a>] avoid conjugating complex numbers, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1331355386" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/83" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/83/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/83">#83</a></li> <li>2022-06-05*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/fa35843a1875e76197a133951e6e033ab77a12b5/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/fa35843a1875e76197a133951e6e033ab77a12b5"><tt>fa35843</tt></a>] implementing JSON-Mmap spec draft 1, <a href="https://neurojson.org/jsonmmap/draft1" rel="nofollow">https://neurojson.org/jsonmmap/draft1</a></li> <li>2022-05-18 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8b74d3034a4993350f2aad5fcb80292fa03aeb7b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8b74d3034a4993350f2aad5fcb80292fa03aeb7b"><tt>8b74d30</tt></a>] make savejd work for saveh5 to save hdf5 files</li> <li>2022-04-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f1332e3a4545a5cd3a433b00435ae011a27d0be7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f1332e3a4545a5cd3a433b00435ae011a27d0be7"><tt>f1332e3</tt></a>] make banner image transparent background</li> <li>2022-04-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6cf82a6cfca52acca37cb7ae9a0fcebeb1e1d05c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6cf82a6cfca52acca37cb7ae9a0fcebeb1e1d05c"><tt>6cf82a6</tt></a>] fix issues found by dependency check</li> <li>2022-04-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/94167bbe0225d7a2e4b304bb682ba218c90518f7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/94167bbe0225d7a2e4b304bb682ba218c90518f7"><tt>94167bb</tt></a>] change neurojson urls to https</li> <li>2022-04-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c4c4da127f2716d08f8493744f20c0af33015a25/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c4c4da127f2716d08f8493744f20c0af33015a25"><tt>c4c4da1</tt></a>] create Contents.m from matlab</li> <li>2022-04-19*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2278bb1c387dec39688e7dbd5606fcb9cdd1a8c9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2278bb1c387dec39688e7dbd5606fcb9cdd1a8c9"><tt>2278bb1</tt></a>] stop escaping / to / in JSON string, see <a href="https://mondotondo.com/2010/12/29/the-solidus-issue/" rel="nofollow">https://mondotondo.com/2010/12/29/the-solidus-issue/</a></li> <li>2022-04-01*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/fb711bb237277ed3640a9d22d240461e3ee00e4c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/fb711bb237277ed3640a9d22d240461e3ee00e4c"><tt>fb711bb</tt></a>] add loadjd and savejd as the unified JSON/binary JSON file interface</li> <li>2022-03-30 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4433a218af2f78059c8f5b8f3465dbb8f0ffe4e0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4433a218af2f78059c8f5b8f3465dbb8f0ffe4e0"><tt>4433a21</tt></a>] improve datalink uri handling to consider : inside uri</li> <li>2022-03-30 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/636840952fefd2646ffced2904c0261e191d078c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/636840952fefd2646ffced2904c0261e191d078c"><tt>6368409</tt></a>] make datalink URL query more robust</li> <li>2022-03-29 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/dd9e9c6876566005c6fda200c1da86756c9262bf/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/dd9e9c6876566005c6fda200c1da86756c9262bf"><tt>dd9e9c6</tt></a>] when file suffix is missing, assume JSON feed</li> <li>2022-03-29*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/07c58f3b98a0729987ced981f2ccb9891bdd9537/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/07c58f3b98a0729987ced981f2ccb9891bdd9537"><tt>07c58f3</tt></a>] initial support for <code>_DataLink_</code> of online/local file with JSONPath ref</li> <li>2022-03-29 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/897b7ba14a359481408803a9e4231aa7831feeee/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/897b7ba14a359481408803a9e4231aa7831feeee"><tt>897b7ba</tt></a>] fix test for older octave</li> <li>2022-03-20 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/bf03eff7143a64993f7a434260fea4037278e12a/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/bf03eff7143a64993f7a434260fea4037278e12a"><tt>bf03eff</tt></a>] force msgpack to use big-endian</li> <li>2022-03-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/46bbfa92db3b543cba28118cbddedf44a135545d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/46bbfa92db3b543cba28118cbddedf44a135545d"><tt>46bbfa9</tt></a>] support empty name key, which is valid in JSON, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1167800334" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/79" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/79/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/79">#79</a></li> <li>2022-03-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9ab040a99ada4164f32ff5824d332de5a5249177/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9ab040a99ada4164f32ff5824d332de5a5249177"><tt>9ab040a</tt></a>] increase default float number digits from 10 to 16, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1161592831" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/78" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/78/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/78">#78</a></li> <li>2022-03-11 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/485ea29026cd7a93aa36b4a6ba7d8ce32fe5b8bb/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/485ea29026cd7a93aa36b4a6ba7d8ce32fe5b8bb"><tt>485ea29</tt></a>] update error message on the valid root-level markers</li> <li>2022-02-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/aa3913e3a87112594908e1e07dfe76806f54cf41/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/aa3913e3a87112594908e1e07dfe76806f54cf41"><tt>aa3913e</tt></a>] disable TFN marker in optimized header due to security risk and low benefit</li> <li>2022-02-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f2c3223c655d24db4bc5b80fde15000756cc9741/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f2c3223c655d24db4bc5b80fde15000756cc9741"><tt>f2c3223</tt></a>] support SCH{[ markers in optimized container type</li> <li>2022-02-14 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/540f95c3de3cce9ff13a9e03ff769454c15a2006/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/540f95c3de3cce9ff13a9e03ff769454c15a2006"><tt>540f95c</tt></a>] add optional preceding whitespace, explain format</li> <li>2022-02-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3dfa904faec470c66b39bdc522a9d149984a7908/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3dfa904faec470c66b39bdc522a9d149984a7908"><tt>3dfa904</tt></a>] debugged and tested mmap, add mmapinclude and mmapexclude options</li> <li>2022-02-10*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6150ae1c788348d3a8450a721af1f21cbacd6bf4/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6150ae1c788348d3a8450a721af1f21cbacd6bf4"><tt>6150ae1</tt></a>] handle uncompressed raw data (only base64 encoded) in jdatadecode</li> <li>2022-02-10 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/88a59eb7071b8018a8983034f62b904a38425468/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/88a59eb7071b8018a8983034f62b904a38425468"><tt>88a59eb</tt></a>] give a warning when jdatadecode fails, but still return the raw data</li> <li>2022-02-03*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/05edb7adac4c057d7e644ecafe677e3a7959b204/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/05edb7adac4c057d7e644ecafe677e3a7959b204"><tt>05edb7a</tt></a>] fast reading and writing json data record using mmap and jsonpath</li> <li>2022-02-02*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b0f0ebd60150c6ef3b876f374b5b76f55c4092ee/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b0f0ebd60150c6ef3b876f374b5b76f55c4092ee"><tt>b0f0ebd</tt></a>] return disk-map or memory-map table in loadjson</li> <li>2022-02-01 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/088821879e4f43fc2ffc0b099a7e8631d326bde0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/088821879e4f43fc2ffc0b099a7e8631d326bde0"><tt>0888218</tt></a>] correct typos and add additional descriptions in README</li> <li>2022-02-01*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/03133c72ab56a262814b9543cb8d7d693fa0edac/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/03133c72ab56a262814b9543cb8d7d693fa0edac"><tt>03133c7</tt></a>] fix row-major ('formatversion',1.8) ND array storage order, update demo outputs</li> <li>2022-02-01 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5998c7039463a880b16ba53e071b8f76b081bcdf/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5998c7039463a880b16ba53e071b8f76b081bcdf"><tt>5998c70</tt></a>] revert variable name encoding to support unicode strings</li> <li>2022-01-31 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/16454e7cdb490b59c3a64c2de805baed4c40dbce/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/16454e7cdb490b59c3a64c2de805baed4c40dbce"><tt>16454e7</tt></a>] test flexible whitespaces in 1D/2D arrays, test mixed array from string</li> <li>2022-01-31*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5c1ef15537e23deb8965d051b40d9fe3713ff6c3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5c1ef15537e23deb8965d051b40d9fe3713ff6c3"><tt>5c1ef15</tt></a>] accelerate fastarrayparser by 200%! jsonlab_speedtest cuts from 11s to 5.8s</li> <li>2022-01-30 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9b25e202a46d45621aca50bb36e19f32deeb847f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9b25e202a46d45621aca50bb36e19f32deeb847f"><tt>9b25e20</tt></a>] fix octave 3.8 error on travis, it does not support single</li> <li>2022-01-30 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5898f6ec0e2510fa4f0b9d64532cfe755f38d826/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5898f6ec0e2510fa4f0b9d64532cfe755f38d826"><tt>5898f6e</tt></a>] add octave 5.2 to travis</li> <li>2022-01-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd"><tt>2e3344c</tt></a>] [bjdata:breaking] Upgrade <code>savebj/loadbj</code> to BJData v1-draft 2, use little-endian by default</li> <li>2022-01-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd"><tt>2e3344c</tt></a>] [bjdata:breaking] Fix optimized ND array element order (previously used column-major)</li> <li>2022-01-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd"><tt>2e3344c</tt></a>] optimize loadjson and loadbj speed</li> <li>2022-01-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd"><tt>2e3344c</tt></a>] add 'BuiltinJSON' option for <code>savejson/loadjson</code> to call <code>jsonencode/jsondecode</code></li> <li>2022-01-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e3344c93b6a3165049cead95e710bb7aabfafdd"><tt>2e3344c</tt></a>] more robust tests on ND array when parsing JSON numerical array construct</li> <li>2021-06-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/632531f4e9bc6f47dc607a12ff1585638fc449c0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/632531f4e9bc6f47dc607a12ff1585638fc449c0"><tt>632531f</tt></a>] fix inconsistency between singlet integer and float values, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="713310245" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/70" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/70/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/70">#70</a></li> <li>2021-06-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f7d82262ff13dfffb6255e62723a8a1e73347c73/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f7d82262ff13dfffb6255e62723a8a1e73347c73"><tt>f7d8226</tt></a>] prevent function calls when parsing array strings using eval, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="925491692" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/75" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/75/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/75">#75</a></li> <li>2021-06-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/b1ae5fa911b2a3011215fd3c2a343cb0810973d0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/b1ae5fa911b2a3011215fd3c2a343cb0810973d0"><tt>b1ae5fa</tt></a>] fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="837134678" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/73" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/73/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/73">#73</a> as a regression to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="137909245" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/22" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/22/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/22">#22</a></li> <li>2021-11-22*[ ] octave-jsonlab is officially in Debian Testing/Bullseye</li> <li>2020-09-29 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d0cb3b8805bf351060aa509e228c8701633cdd13/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d0cb3b8805bf351060aa509e228c8701633cdd13"><tt>d0cb3b8</tt></a>] Fix for loading objects.</li> <li>2020-07-26 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d0fb684bd43165d312063345bdb795b628b2c679/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d0fb684bd43165d312063345bdb795b628b2c679"><tt>d0fb684</tt></a>] Add travis badge</li> <li>2020-07-25 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/708c36c3faf028f38bfad2705138a4b430ca592f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/708c36c3faf028f38bfad2705138a4b430ca592f"><tt>708c36c</tt></a>] drop octave 3.2</li> <li>2020-07-25 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/436d84e395f3a2df1798ecc77b75d42f6503ebe9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/436d84e395f3a2df1798ecc77b75d42f6503ebe9"><tt>436d84e</tt></a>] debug octave 3.2</li> <li>2020-07-25 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0ce96ecc725c680740854baf5b780cc7b7394f96/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0ce96ecc725c680740854baf5b780cc7b7394f96"><tt>0ce96ec</tt></a>] remove windows and osx targets from travis-ci</li> <li>2020-07-25 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0d8baa4e0789a38a9ca268e0cf604c7803886485/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0d8baa4e0789a38a9ca268e0cf604c7803886485"><tt>0d8baa4</tt></a>] fix ruby does not support error on windows</li> <li>2020-07-25*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/faa7921268b7c16c4da67d63e37b059f3d014bb7/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/faa7921268b7c16c4da67d63e37b059f3d014bb7"><tt>faa7921</tt></a>] enable travis-ci for jsonlab</li> <li>2020-07-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/321ab1ac8b5cffbd24ec4bb7b83504db133d417e/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/321ab1ac8b5cffbd24ec4bb7b83504db133d417e"><tt>321ab1a</tt></a>] add Debian and Ubuntu installation commands</li> <li>2020-07-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e686828760f59844960128be9d79141ec4c096ed/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e686828760f59844960128be9d79141ec4c096ed"><tt>e686828</tt></a>] update author info</li> <li>2020-07-08*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ce40fdf608b2a2f6bf654233940ccf1cd97d9698/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ce40fdf608b2a2f6bf654233940ccf1cd97d9698"><tt>ce40fdf</tt></a>] supports ND cell array, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="652372219" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/66" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/66/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/66">#66</a></li> <li>2020-07-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6a8ce9338d4bfc9119645f3e01d3f235dae59b91/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6a8ce9338d4bfc9119645f3e01d3f235dae59b91"><tt>6a8ce93</tt></a>] fix string encoding over 399 characters, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="652309093" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/65" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/65/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/65">#65</a></li> <li>2020-06-14 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/5a58fafdca239e61be4d7b2270307b2445bb571a/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/5a58fafdca239e61be4d7b2270307b2445bb571a"><tt>5a58faf</tt></a>] fix DESCRIPTION date bug</li> <li>2020-06-14 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9d7e94cf726555f737310323ef5f1e5c8ba60fe3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9d7e94cf726555f737310323ef5f1e5c8ba60fe3"><tt>9d7e94c</tt></a>] match octave description file and upstream version number</li> <li>2020-06-14 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a5b617052e8ae584adb191bdae595b9f61951fdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a5b617052e8ae584adb191bdae595b9f61951fdd"><tt>a5b6170</tt></a>] fix warning about <code>lz4encode</code> file name</li> </ul> <p>Please note that the <code>savejson/loadjson</code> in both JSONLab v2.0-v3.0 are compliant with JData Spec Draft 3; the <code>savebj/loadbj</code> in JSONLab v3.0 is compatible to BJData spec Draft 2, which contains breaking feature changes compared to those in JSONLab v2.0.</p> <p>The BJData spec was derived from UBJSON spec Draft 12, with the following breaking differences:</p> <ul> <li>BJData adds 4 new numeric data types: <code>uint16 [u]</code>, <code>uint32 [m]</code>, <code>uint64 [M]</code> and <code>float16 [h]</code> (supported in JSONLab v2.0 or newer)</li> <li>BJData supports an optimized ND array container (supported in JSONLab since 2013)</li> <li>BJData does not convert <code>NaN/Inf/-Inf</code> to <code>null</code> (supported in JSONLab since 2013)</li> <li>BJData Draft 2 changes the default byte order to Little-Endian instead of Big-Endian (JSONLab 3.0 or later)</li> <li>BJData only permits non-zero-fixed-length data types as the optimized array type, i.e. only <code>UiuImlMLhdDC</code> are allowed</li> </ul> <p>To avoid using the new features, one should attach <code>'UBJSON',1</code> and <code>'Endian','B'</code> in the <code>savebj</code> command as</p> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="savebj('',data,'FileName','myfile.bjd','UBJSON',1, 'Endian','B');"><pre>savebj(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">data</span>,<span class="pl-s"><span class="pl-pds">'</span>FileName<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>myfile.bjd<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>UBJSON<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>, <span class="pl-s"><span class="pl-pds">'</span>Endian<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>B<span class="pl-pds">'</span></span>);</pre></div> <p>To read BJData data files generated by JSONLab v2.0, you should call</p> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="data=loadbj('my_old_data_file.bjd','Endian','B')"><pre>data<span class="pl-k">=</span>loadbj(<span class="pl-s"><span class="pl-pds">'</span>my_old_data_file.bjd<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>Endian<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>B<span class="pl-pds">'</span></span>)</pre></div> <p>You are strongly encouraged to convert all pre-v2.9 JSONLab generated BJD or .pmat files using the new format.</p> <h2>Introduction</h2> <p>JSONLab is an open-source JSON/UBJSON/MessagePack encoder and decoder written completely in the native MATLAB language. It can be used to convert most MATLAB data structures (array, struct, cell, struct array, cell array, and objects) into JSON/UBJSON/MessagePack formatted strings and files, or to parse a JSON/UBJSON/MessagePack file into a MATLAB data structure. JSONLab supports both MATLAB and <a href="http://www.gnu.org/software/octave" rel="nofollow">GNU Octave</a> (a free MATLAB clone).</p> <p>Compared to other MATLAB/Octave JSON parsers, JSONLab is uniquely lightweight, ultra-portable, producing dependable outputs across a wide-range of MATLAB (tested on R2008) and Octave (tested on v3.8) versions. It also uniquely supports BinaryJData/UBJSON/MessagePack data files as binary-JSON-like formats, designed for efficiency and flexibility with loss-less binary storage. As a parser written completely with the native MATLAB language, it is surprisingly fast when reading small-to-moderate sized JSON files (1-2 MB) with simple hierarchical structures, and is heavily optimized for reading JSON files containing large N-D arrays (known as the "fast array parser" in <code>loadjson</code>).</p> <p>JSON (<a href="http://www.json.org/" rel="nofollow">JavaScript Object Notation</a>) is a highly portable, human-readable and <a href="http://en.wikipedia.org/wiki/JSON" rel="nofollow">"fat-free"</a> text format to represent complex and hierarchical data, widely used for data-exchange in applications. UBJSON (<a href="http://ubjson.org/" rel="nofollow">Universal Binary JSON</a>) is a binary JSON format, designed to specifically address the limitations of JSON, permitting the storage of binary data with strongly typed data records, resulting in smaller file sizes and fast encoding and decoding. MessagePack is another binary JSON-like data format widely used in data exchange in web/native applications. It is slightly more compact than UBJSON, but is not directly readable compared to UBJSON.</p> <p>We envision that both JSON and its binary counterparts will play important roles for storage, exchange and interoperation of large-scale scientific data among the wide-variety of tools. As container-formats, they offer both the flexibility and generality similar to other more sophisticated formats such as <a href="http://www.hdfgroup.org/HDF5/whatishdf5.html" rel="nofollow">HDF5</a>, but are significantly<br> simpler with a much greater software ecosystem.</p> <p>Towards this goal, we have developed the JData Specification (<a href="https://github.com/NeuroJSON/jdata">http://github.com/NeuroJSON/jdata</a>) to standardize serializations of complex scientific data structures, such as N-D arrays, sparse/complex-valued arrays, trees, maps, tables and graphs using JSON/binary JSON constructs. The text and binary formatted JData files are syntactically compatible with JSON/UBJSON formats, and can be readily parsed using existing JSON and UBJSON parsers. JSONLab is not just a parser and writer of JSON/UBJSON data files, but one that systematically converts complex scientific data structures into human-readable and universally supported JSON forms using the standardized JData data annotations.</p> <h2>Installation</h2> <p>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:</p> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="addpath('/path/to/jsonlab');"><pre>addpath(<span class="pl-s"><span class="pl-pds">'</span>/path/to/jsonlab<span class="pl-pds">'</span></span>);</pre></div> <p>If you want to add this path permanently, you can type <code>pathtool</code>, browse to the JSONLab root folder and add to the list, then click "Save". Then, run <code>rehash</code> in MATLAB, and type <code>which savejson</code>, if you see an output, that means JSONLab is installed for MATLAB/Octave.</p> <p>If you use MATLAB in a shared environment such as a Linux server, the best way to add path is to type</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mkdir ~/matlab/ nano ~/matlab/startup.m"><pre>mkdir <span class="pl-k">~</span>/matlab/ nano <span class="pl-k">~</span>/matlab/startup.m</pre></div> <p>and type <code>addpath('/path/to/jsonlab')</code> 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 <code>~/.octaverc</code>, where <code>~</code> is your home directory.</p> <p>To use the data compression features, please download the ZMat toolbox from <a href="https://github.com/NeuroJSON/zmat/releases/latest">https://github.com/NeuroJSON/zmat/releases/latest</a> and follow the instruction to install ZMat first. The ZMat toolbox is required when compression is used on MATLAB running in the <code>-nojvm</code> 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.</p> <h3>Install JSONLab on Fedora 24 or later</h3> <p>JSONLab has been available as an official Fedora package since 2015. You may install it directly using the below command</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo dnf install octave-jsonlab"><pre>sudo dnf install octave-jsonlab</pre></div> <p>To enable data compression/decompression, you need to install <code>octave-zmat</code> using</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo dnf install octave-zmat"><pre>sudo dnf install octave-zmat</pre></div> <p>Then open Octave, and type <code>pkg load jsonlab</code> to enable jsonlab toolbox.</p> <h3>Install JSONLab on Debian</h3> <p>JSONLab is currently available on Debian Bullseye. To install, you may run</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo apt-get install octave-jsonlab"><pre>sudo apt-get install octave-jsonlab</pre></div> <p>One can alternatively install <code>matlab-jsonlab</code> if MATLAB is available.</p> <h3>Install JSONLab on Ubuntu</h3> <p>JSONLab is currently available on Ubuntu 21.04 or newer as package octave-jsonlab. To install, you may run</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo apt-get install octave-jsonlab"><pre>sudo apt-get install octave-jsonlab</pre></div> <p>For older Ubuntu releases, one can add the below PPA</p> <p><a href="https://launchpad.net/~fangq/+archive/ubuntu/ppa" rel="nofollow">https://launchpad.net/~fangq/+archive/ubuntu/ppa</a></p> <p>To install, please run</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo add-apt-repository ppa:fangq/ppa sudo apt-get update"><pre>sudo add-apt-repository ppa:fangq/ppa sudo apt-get update</pre></div> <p>to add this PPA, and then use</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo apt-get install octave-jsonlab"><pre>sudo apt-get install octave-jsonlab</pre></div> <p>to install the toolbox. <code>octave-zmat</code> will be automatically installed.</p> <h3>Install JSONLab on Arch Linux</h3> <p>JSONLab is also available on Arch Linux. You may install it using the below command</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo pikaur -S jsonlab"><pre>sudo pikaur -S jsonlab</pre></div> <h2>Using JSONLab</h2> <p>JSONLab provides a pair of functions, <code>loadjson</code> -- a JSON parser, and <code>savejson</code> -- a MATLAB-to-JSON encoder, to read/write the text-based JSON; it also provides three equivalent pairs -- <code>loadbj/savebj</code> for binary JData, <code>loadubjson/saveubjson</code> for UBJSON and <code>loadmsgpack/savemsgpack</code> for MessagePack. The <code>load*</code> functions for the 3 supported data formats share almost the same input parameter format, similarly for the 3 <code>save*</code> functions (<code>savejson/saveubjson/savemsgpack</code>). These encoders and decoders are capable of processing/sharing almost all data structures supported by MATLAB, thanks to <code>jdataencode/jdatadecode</code> - a pair of in-memory data converters translating complex MATLAB data structures to their easy-to-serialized forms according to the JData specifications. The detailed help information can be found in the <code>Contents.m</code> file.</p> <p>In JSONLab 2.9.8 and later versions, a unified file loading and saving interface is provided for JSON, binary JSON and HDF5, including <code>loadjd</code> and <code>savejd</code> for reading and writing below files types:</p> <ul> <li>JSON based files: <code>.json</code>, <code>.jdt</code> (text JData file), <code>.jmsh</code> (text JMesh file), <code>.jnii</code> (text JNIfTI file), <code>.jnirs</code> (text JSNIRF file)</li> <li>BJData based files: <code>.bjd</code>, <code>.jdb</code> (binary JData file), <code>.bmsh</code> (binary JMesh file), <code>.bnii</code> (binary JNIfTI file), <code>.bnirs</code> (binary JSNIRF file), <code>.pmat</code> (MATLAB session file)</li> <li>UBJSON based files: <code>.ubj</code></li> <li>MessagePack based files: <code>.msgpack</code></li> <li>HDF5 based files: <code>.h5</code>, <code>.hdf5</code>, <code>.snirf</code> (SNIRF fNIRS data files) - require <a href="https://github.com/NeuroJSON/easyh5">EasyH5 toolbox</a></li> </ul> <p>In the below section, we provide a few examples on how to us each of the core functions for encoding/decoding JSON/Binary JSON/MessagePack data.</p> <h3>savejson.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="jsonmesh=struct('MeshNode',[0 0 0;1 0 0;0 1 0;1 1 0;0 0 1;1 0 1;0 1 1;1 1 1],... 'MeshElem',[1 2 4 8;1 3 4 8;1 2 6 8;1 5 6 8;1 5 7 8;1 3 7 8],... 'MeshSurf',[1 2 4;1 2 6;1 3 4;1 3 7;1 5 6;1 5 7;... 2 8 4;2 8 6;3 8 4;3 8 7;5 8 6;5 8 7],... 'MeshCreator','FangQ','MeshTitle','T6 Cube',... 'SpecialData',[nan, inf, -inf]); % convert any matlab variables to JSON (variable name is used as the root name) savejson(jsonmesh) % convert matlab variables to JSON with a root-name &quot;jmesh&quot; savejson('jmesh',jsonmesh) % an empty root-name directly embed the data in the root {} % the compact=1 flag prints JSON without white-space in a single-line savejson('',jsonmesh,'Compact',1) % if 3 inputs are given, the 3rd parameter defines the output file name savejson('jmesh',jsonmesh,'outputfile.json') % param/value pairs can be provided after the 2nd input to customize outputs % if you want to use params/values and save JSON to a file, you must use the 'filename' to set output file savejson('',jsonmesh,'FileName','outputfile2.json','ArrayIndent',0,'FloatFormat','\t%.5g') % jsonlab utilizes JData annotations to encode complex/sparse ND-arrays savejson('cpxrand',eye(5)+1i*magic(5)) % when setting 'BuiltinJSON' to 1, savejson calls jsonencode.m in MATLAB (R2016+) % or Octave (v7+) to convert data to JSON; this is typically faster, but does not % support all features native savejson offers savejson('cpxrand',eye(5)+1i*magic(5), 'BuiltinJSON', 1) % JData annotations also allows one to compress binary strongly-typed data and store in the JSON % gzip/zlib are natively supported in MATLAB and Octave; using ZMat toolbox, one can use lz4, lzma, blosc2 etc compressors savejson('ziparray',eye(10),'Compression','zlib','CompressArraySize',1) % 'ArrayToStruct' flag forces all arrays to use the JData ND array annotations to preserve types savejson('',jsonmesh,'ArrayToStruct',1) % JData supports compact storage of special matrices using the '_ArrayShape_' annotation savejson('',eye(10),'UseArrayShape',1)"><pre>jsonmesh<span class="pl-k">=</span>struct(<span class="pl-s"><span class="pl-pds">'</span>MeshNode<span class="pl-pds">'</span></span>,[<span class="pl-c1">0</span> <span class="pl-c1">0</span> <span class="pl-c1">0</span>;1 <span class="pl-c1">0</span> <span class="pl-c1">0</span>;0 <span class="pl-c1">1</span> <span class="pl-c1">0</span>;1 <span class="pl-c1">1</span> <span class="pl-c1">0</span>;0 <span class="pl-c1">0</span> <span class="pl-c1">1</span>;1 <span class="pl-c1">0</span> <span class="pl-c1">1</span>;0 <span class="pl-c1">1</span> <span class="pl-c1">1</span>;1 <span class="pl-c1">1</span> <span class="pl-c1">1</span>],...<span class="pl-c"> </span> <span class="pl-s"><span class="pl-pds">'</span>MeshElem<span class="pl-pds">'</span></span>,[<span class="pl-c1">1</span> <span class="pl-c1">2</span> <span class="pl-c1">4</span> <span class="pl-c1">8</span>;1 <span class="pl-c1">3</span> <span class="pl-c1">4</span> <span class="pl-c1">8</span>;1 <span class="pl-c1">2</span> <span class="pl-c1">6</span> <span class="pl-c1">8</span>;1 <span class="pl-c1">5</span> <span class="pl-c1">6</span> <span class="pl-c1">8</span>;1 <span class="pl-c1">5</span> <span class="pl-c1">7</span> <span class="pl-c1">8</span>;1 <span class="pl-c1">3</span> <span class="pl-c1">7</span> <span class="pl-c1">8</span>],... <span class="pl-s"><span class="pl-pds">'</span>MeshSurf<span class="pl-pds">'</span></span>,[<span class="pl-c1">1</span> <span class="pl-c1">2</span> <span class="pl-c1">4</span>;1 <span class="pl-c1">2</span> <span class="pl-c1">6</span>;1 <span class="pl-c1">3</span> <span class="pl-c1">4</span>;1 <span class="pl-c1">3</span> <span class="pl-c1">7</span>;1 <span class="pl-c1">5</span> <span class="pl-c1">6</span>;1 <span class="pl-c1">5</span> <span class="pl-c1">7</span>;... <span class="pl-c1">2</span> <span class="pl-c1">8</span> <span class="pl-c1">4</span>;2 <span class="pl-c1">8</span> <span class="pl-c1">6</span>;3 <span class="pl-c1">8</span> <span class="pl-c1">4</span>;3 <span class="pl-c1">8</span> <span class="pl-c1">7</span>;5 <span class="pl-c1">8</span> <span class="pl-c1">6</span>;5 <span class="pl-c1">8</span> <span class="pl-c1">7</span>],... <span class="pl-s"><span class="pl-pds">'</span>MeshCreator<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>FangQ<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>MeshTitle<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>T6 Cube<span class="pl-pds">'</span></span>,... <span class="pl-s"><span class="pl-pds">'</span>SpecialData<span class="pl-pds">'</span></span>,[<span class="pl-c1">nan</span>, <span class="pl-c1">inf</span>, <span class="pl-k">-</span><span class="pl-c1">inf</span>]); <span class="pl-c"><span class="pl-c">%</span> convert any matlab variables to JSON (variable name is used as the root name)</span> savejson(<span class="pl-smi">jsonmesh</span>) <span class="pl-c"><span class="pl-c">%</span> convert matlab variables to JSON with a root-name "jmesh"</span> savejson(<span class="pl-s"><span class="pl-pds">'</span>jmesh<span class="pl-pds">'</span></span>,<span class="pl-smi">jsonmesh</span>) <span class="pl-c"><span class="pl-c">%</span> an empty root-name directly embed the data in the root {}</span> <span class="pl-c"><span class="pl-c">%</span> the compact=1 flag prints JSON without white-space in a single-line</span> savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">jsonmesh</span>,<span class="pl-s"><span class="pl-pds">'</span>Compact<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> if 3 inputs are given, the 3rd parameter defines the output file name</span> savejson(<span class="pl-s"><span class="pl-pds">'</span>jmesh<span class="pl-pds">'</span></span>,<span class="pl-smi">jsonmesh</span>,<span class="pl-s"><span class="pl-pds">'</span>outputfile.json<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> param/value pairs can be provided after the 2nd input to customize outputs</span> <span class="pl-c"><span class="pl-c">%</span> if you want to use params/values and save JSON to a file, you must use the 'filename' to set output file</span> savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">jsonmesh</span>,<span class="pl-s"><span class="pl-pds">'</span>FileName<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>outputfile2.json<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>ArrayIndent<span class="pl-pds">'</span></span>,<span class="pl-c1">0</span>,<span class="pl-s"><span class="pl-pds">'</span>FloatFormat<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span><span class="pl-cce">\t%.5g</span><span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> jsonlab utilizes JData annotations to encode complex/sparse ND-arrays</span> savejson(<span class="pl-s"><span class="pl-pds">'</span>cpxrand<span class="pl-pds">'</span></span>,eye(<span class="pl-c1">5</span>)+<span class="pl-c1">1<span class="pl-k">i</span></span><span class="pl-k">*</span>magic(<span class="pl-c1">5</span>)) <span class="pl-c"><span class="pl-c">%</span> when setting 'BuiltinJSON' to 1, savejson calls jsonencode.m in MATLAB (R2016+)</span> <span class="pl-c"><span class="pl-c">%</span> or Octave (v7+) to convert data to JSON; this is typically faster, but does not</span> <span class="pl-c"><span class="pl-c">%</span> support all features native savejson offers</span> savejson(<span class="pl-s"><span class="pl-pds">'</span>cpxrand<span class="pl-pds">'</span></span>,eye(<span class="pl-c1">5</span>)+<span class="pl-c1">1<span class="pl-k">i</span></span><span class="pl-k">*</span>magic(<span class="pl-c1">5</span>), <span class="pl-s"><span class="pl-pds">'</span>BuiltinJSON<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> JData annotations also allows one to compress binary strongly-typed data and store in the JSON</span> <span class="pl-c"><span class="pl-c">%</span> gzip/zlib are natively supported in MATLAB and Octave; using ZMat toolbox, one can use lz4, lzma, blosc2 etc compressors</span> savejson(<span class="pl-s"><span class="pl-pds">'</span>ziparray<span class="pl-pds">'</span></span>,eye(<span class="pl-c1">10</span>),<span class="pl-s"><span class="pl-pds">'</span>Compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>zlib<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>CompressArraySize<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> 'ArrayToStruct' flag forces all arrays to use the JData ND array annotations to preserve types</span> savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">jsonmesh</span>,<span class="pl-s"><span class="pl-pds">'</span>ArrayToStruct<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> JData supports compact storage of special matrices using the '_ArrayShape_' annotation</span> savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,eye(<span class="pl-c1">10</span>),<span class="pl-s"><span class="pl-pds">'</span>UseArrayShape<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>)</pre></div> <h3>loadjson.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% loadjson can directly parse a JSON string if it starts with &quot;[&quot; or &quot;{&quot;, here is an empty object loadjson('{}') % loadjson can also parse complex JSON objects in a string form dat=loadjson('{&quot;obj&quot;:{&quot;string&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}') % if the input is a file name, loadjson reads the file and parse the data inside dat=loadjson(['examples' filesep 'example1.json']) % param/value pairs can be used following the 1st input to customize the parsing behavior dat=loadjson(['examples' filesep 'example1.json'],'SimplifyCell',0) % if a URL is provided, loadjson reads JSON data from the URL and return the parsed results, % similar to webread, except loadjson calls jdatadecode to decode JData annotations dat=loadjson('https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json') % using the 'BuildinJSON' flag, one can use the built-in jsondecode.m in MATLAB (R2016+) % or Octave (7.0+) to parse the JSON data for better speed, note that jsondecode encode % key names differently compared to loadjson dat=loadjson('{&quot;_obj&quot;:{&quot;string&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}', 'builtinjson', 1) % when the JSON data contains long key names, one can use 'UseMap' flag to % request loadjson to store the data in a containers.Map instead of struct (key name limited to 63) dat=loadjson('{&quot;obj&quot;:{&quot;an object with a key longer than 63&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}', 'UseMap', 1) % loadjson can further download the linked data pointed by `_DataLink_` tag, and merge with the parent dat=loadjson('{&quot;obj&quot;:{&quot;_DataLink_&quot;:&quot;https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json&quot;},&quot;array&quot;:[1,2]}','maxlinklevel',1) % a JSONPath can be attached to the URL to retrieve a sub element dat=loadjson('{&quot;obj&quot;:{&quot;_DataLink_&quot;:&quot;https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json:$.address.city&quot;},&quot;array&quot;:[1,2]}','maxlinklevel',1) % loadjson can optionally return a JSON-memory-map object, which defines each JSON element's % memory buffer offset and length to enable disk-map like fast read/write operations [dat, mmap]=loadjson('{&quot;obj&quot;:{&quot;key&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}') % if set 'mmaponly' to 1, loadjson only returns the JSON-mmap structure mmap=loadjson('{&quot;obj&quot;:{&quot;key&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}', 'mmaponly', 1)"><pre><span class="pl-c"><span class="pl-c">%</span> loadjson can directly parse a JSON string if it starts with "[" or "{", here is an empty object</span> loadjson(<span class="pl-s"><span class="pl-pds">'</span>{}<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> loadjson can also parse complex JSON objects in a string form</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"string":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> if the input is a file name, loadjson reads the file and parse the data inside</span> dat<span class="pl-k">=</span>loadjson([<span class="pl-s"><span class="pl-pds">'</span>examples<span class="pl-pds">'</span></span> <span class="pl-smi">filesep</span> <span class="pl-s"><span class="pl-pds">'</span>example1.json<span class="pl-pds">'</span></span>]) <span class="pl-c"><span class="pl-c">%</span> param/value pairs can be used following the 1st input to customize the parsing behavior</span> dat<span class="pl-k">=</span>loadjson([<span class="pl-s"><span class="pl-pds">'</span>examples<span class="pl-pds">'</span></span> <span class="pl-smi">filesep</span> <span class="pl-s"><span class="pl-pds">'</span>example1.json<span class="pl-pds">'</span></span>],<span class="pl-s"><span class="pl-pds">'</span>SimplifyCell<span class="pl-pds">'</span></span>,<span class="pl-c1">0</span>) <span class="pl-c"><span class="pl-c">%</span> if a URL is provided, loadjson reads JSON data from the URL and return the parsed results,</span> <span class="pl-c"><span class="pl-c">%</span> similar to webread, except loadjson calls jdatadecode to decode JData annotations</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> using the 'BuildinJSON' flag, one can use the built-in jsondecode.m in MATLAB (R2016+)</span> <span class="pl-c"><span class="pl-c">%</span> or Octave (7.0+) to parse the JSON data for better speed, note that jsondecode encode</span> <span class="pl-c"><span class="pl-c">%</span> key names differently compared to loadjson</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"_obj":{"string":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>builtinjson<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> when the JSON data contains long key names, one can use 'UseMap' flag to</span> <span class="pl-c"><span class="pl-c">%</span> request loadjson to store the data in a containers.Map instead of struct (key name limited to 63)</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"an object with a key longer than 63":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>UseMap<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> loadjson can further download the linked data pointed by `_DataLink_` tag, and merge with the parent</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"_DataLink_":"https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json"},"array":[1,2]}<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>maxlinklevel<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> a JSONPath can be attached to the URL to retrieve a sub element</span> dat<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"_DataLink_":"https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json:$.address.city"},"array":[1,2]}<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>maxlinklevel<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> loadjson can optionally return a JSON-memory-map object, which defines each JSON element's</span> <span class="pl-c"><span class="pl-c">%</span> memory buffer offset and length to enable disk-map like fast read/write operations</span> [<span class="pl-smi">dat</span>, <span class="pl-smi">mmap</span>]=loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"key":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> if set 'mmaponly' to 1, loadjson only returns the JSON-mmap structure</span> mmap<span class="pl-k">=</span>loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"key":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>)</pre></div> <h3>savebj.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% savebj works almost exactly like savejson, except that the output is the more compact binary JSON a={single(rand(2)), struct('va',1,'vb','string'), 1+2i}; savebj(a) % customizing the root-name using the 1st input, and the 3rd input setting the output file savebj('rootname',a,'testdata.ubj') % enabling the 'debug' flag to allow printing binary JSON in text-form, helping users to run tests or troubleshoot savebj('rootname',a, 'debug',1) % like savejson, savebj also allow data compression for even more compact storage savebj('zeros',zeros(100),'Compression','gzip') % binary JSON does not need base64-encoding, therefore, the output can be ~33% smaller than text-based JSON [length(savebj('magic',magic(100),'Compression','zlib')), length(savejson('magic',magic(100),'Compression','zlib'))] % savebj can output other popular binary JSON formats, such as MessagePack or UBJSON savebj('mesh',a,'FileName','meshdata.msgpk','MessagePack',1) % same as calling savemsgpack savebj('mesh',a,'FileName','meshdata.ubj','UBJSON',1) % same as calling saveubjson"><pre><span class="pl-c"><span class="pl-c">%</span> savebj works almost exactly like savejson, except that the output is the more compact binary JSON</span> a<span class="pl-k">=</span>{single(rand(<span class="pl-c1">2</span>)), struct(<span class="pl-s"><span class="pl-pds">'</span>va<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>,<span class="pl-s"><span class="pl-pds">'</span>vb<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>string<span class="pl-pds">'</span></span>), <span class="pl-c1">1</span><span class="pl-k">+</span><span class="pl-c1">2<span class="pl-k">i</span></span>}; savebj(<span class="pl-smi">a</span>) <span class="pl-c"><span class="pl-c">%</span> customizing the root-name using the 1st input, and the 3rd input setting the output file</span> savebj(<span class="pl-s"><span class="pl-pds">'</span>rootname<span class="pl-pds">'</span></span>,<span class="pl-smi">a</span>,<span class="pl-s"><span class="pl-pds">'</span>testdata.ubj<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> enabling the 'debug' flag to allow printing binary JSON in text-form, helping users to run tests or troubleshoot</span> savebj(<span class="pl-s"><span class="pl-pds">'</span>rootname<span class="pl-pds">'</span></span>,<span class="pl-smi">a</span>, <span class="pl-s"><span class="pl-pds">'</span>debug<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> like savejson, savebj also allow data compression for even more compact storage</span> savebj(<span class="pl-s"><span class="pl-pds">'</span>zeros<span class="pl-pds">'</span></span>,zeros(<span class="pl-c1">100</span>),<span class="pl-s"><span class="pl-pds">'</span>Compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>gzip<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> binary JSON does not need base64-encoding, therefore, the output can be ~33% smaller than text-based JSON</span> [length(savebj(<span class="pl-s"><span class="pl-pds">'</span>magic<span class="pl-pds">'</span></span>,magic(<span class="pl-c1">100</span>),<span class="pl-s"><span class="pl-pds">'</span>Compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>zlib<span class="pl-pds">'</span></span>)), length(savejson(<span class="pl-s"><span class="pl-pds">'</span>magic<span class="pl-pds">'</span></span>,magic(<span class="pl-c1">100</span>),<span class="pl-s"><span class="pl-pds">'</span>Compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>zlib<span class="pl-pds">'</span></span>))] <span class="pl-c"><span class="pl-c">%</span> savebj can output other popular binary JSON formats, such as MessagePack or UBJSON</span> savebj(<span class="pl-s"><span class="pl-pds">'</span>mesh<span class="pl-pds">'</span></span>,<span class="pl-smi">a</span>,<span class="pl-s"><span class="pl-pds">'</span>FileName<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>meshdata.msgpk<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>MessagePack<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> same as calling savemsgpack</span> savebj(<span class="pl-s"><span class="pl-pds">'</span>mesh<span class="pl-pds">'</span></span>,<span class="pl-smi">a</span>,<span class="pl-s"><span class="pl-pds">'</span>FileName<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>meshdata.ubj<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>UBJSON<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> same as calling saveubjson</span></pre></div> <h3>loadbj.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% similarly, loadbj does almost exactly the same as loadjson, but it parses binary JSON instead obj=struct('string','value','array',single([1 2 3]),'empty',[],'magic',uint8(magic(5))); ubjdata=savebj('obj',obj); % loadbj can load a binary JSON (BJData - a derived format from UBJSON) object from a buffer dat=loadbj(ubjdata) % you can test if loadbj parsed object still matches the data saved using savebj class(dat.obj.array) isequaln(obj,dat.obj) % similarly, savebj/loadbj can compress/decompress binary array data using various compressors dat=loadbj(savebj('',eye(10),'Compression','zlib','CompressArraySize',1)) % if given a path to a binary JSON file (.jdb,.bnii,.pmat,.jmsh,...), it opens and parses the file dat=loadbj('/path/to/a/binary_json.jdb'); % loadbj can directly load binary JSON data files from URL, here is a binary-JSON based NIfTI file dat=loadbj('https://neurojson.org/io/stat.cgi?action=get&amp;db=abide&amp;doc=CMU_b&amp;file=0a429cb9101b733f594eefc1261d6985-zlib.bnii') % similar to loadjson, loadbj can also return JSON-memory-map to permit disk-map % like direct reading/writing of specific data elements [dat, mmap]=loadbj(ubjdata) mmap=loadbj(ubjdata, 'mmaponly', 1)"><pre><span class="pl-c"><span class="pl-c">%</span> similarly, loadbj does almost exactly the same as loadjson, but it parses binary JSON instead</span> obj<span class="pl-k">=</span>struct(<span class="pl-s"><span class="pl-pds">'</span>string<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>value<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>array<span class="pl-pds">'</span></span>,single([<span class="pl-c1">1</span> <span class="pl-c1">2</span> <span class="pl-c1">3</span>]),<span class="pl-s"><span class="pl-pds">'</span>empty<span class="pl-pds">'</span></span>,[],<span class="pl-s"><span class="pl-pds">'</span>magic<span class="pl-pds">'</span></span>,uint8(magic(<span class="pl-c1">5</span>))); ubjdata<span class="pl-k">=</span>savebj(<span class="pl-s"><span class="pl-pds">'</span>obj<span class="pl-pds">'</span></span>,<span class="pl-smi">obj</span>); <span class="pl-c"><span class="pl-c">%</span> loadbj can load a binary JSON (BJData - a derived format from UBJSON) object from a buffer</span> dat<span class="pl-k">=</span>loadbj(<span class="pl-smi">ubjdata</span>) <span class="pl-c"><span class="pl-c">%</span> you can test if loadbj parsed object still matches the data saved using savebj</span> class(<span class="pl-smi">dat</span>.<span class="pl-smi">obj</span>.<span class="pl-smi">array</span>) isequaln(<span class="pl-smi">obj</span>,<span class="pl-smi">dat</span>.<span class="pl-smi">obj</span>) <span class="pl-c"><span class="pl-c">%</span> similarly, savebj/loadbj can compress/decompress binary array data using various compressors</span> dat<span class="pl-k">=</span>loadbj(savebj(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,eye(<span class="pl-c1">10</span>),<span class="pl-s"><span class="pl-pds">'</span>Compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>zlib<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>CompressArraySize<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>)) <span class="pl-c"><span class="pl-c">%</span> if given a path to a binary JSON file (.jdb,.bnii,.pmat,.jmsh,...), it opens and parses the file</span> dat<span class="pl-k">=</span>loadbj(<span class="pl-s"><span class="pl-pds">'</span>/path/to/a/binary_json.jdb<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">%</span> loadbj can directly load binary JSON data files from URL, here is a binary-JSON based NIfTI file</span> dat<span class="pl-k">=</span>loadbj(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.org/io/stat.cgi?action=get&amp;db=abide&amp;doc=CMU_b&amp;file=0a429cb9101b733f594eefc1261d6985-zlib.bnii<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> similar to loadjson, loadbj can also return JSON-memory-map to permit disk-map</span> <span class="pl-c"><span class="pl-c">%</span> like direct reading/writing of specific data elements</span> [<span class="pl-smi">dat</span>, <span class="pl-smi">mmap</span>]=loadbj(<span class="pl-smi">ubjdata</span>) mmap<span class="pl-k">=</span>loadbj(<span class="pl-smi">ubjdata</span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>)</pre></div> <h3>jdataencode.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% jdataencode transforms complex MATLAB data structures (ND-array, sparse array, complex arrays, % table, graph, containers.Map etc) into JSON-serializable forms using portable JData annotations % here, we show how to save a complex-valued sparse array using JSON JData annotations testdata = struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5)); jd=jdataencode(testdata) savejson('',jd) % when setting 'annotatearray' to 1, jdataencode uses _ArrayType_/_ArraySize_/_ArrayData_ % JData tags to store ND array to preserve data types; use 'prefix' to customize variable name prefix encodedmat=jdataencode(single(magic(5)),'annotatearray',1,'prefix','x') % when setting 'usearrayshape' to 1, jdataencode can use _ArrayShape_ to encode special matrices encodedtoeplitz=jdataencode(uint8(toeplitz([1,2,3,4],[1,5,6])),'usearrayshape',1)"><pre><span class="pl-c"><span class="pl-c">%</span> jdataencode transforms complex MATLAB data structures (ND-array, sparse array, complex arrays,</span> <span class="pl-c"><span class="pl-c">%</span> table, graph, containers.Map etc) into JSON-serializable forms using portable JData annotations</span> <span class="pl-c"><span class="pl-c">%</span> here, we show how to save a complex-valued sparse array using JSON JData annotations</span> testdata <span class="pl-k">=</span> struct(<span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>,rand(<span class="pl-c1">5</span>)+<span class="pl-c1">1<span class="pl-k">i</span></span><span class="pl-k">*</span>rand(<span class="pl-c1">5</span>),<span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>,[],<span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>,sparse(<span class="pl-c1">5</span>,<span class="pl-c1">5</span>)); jd<span class="pl-k">=</span>jdataencode(<span class="pl-smi">testdata</span>) savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">jd</span>) <span class="pl-c"><span class="pl-c">%</span> when setting 'annotatearray' to 1, jdataencode uses _ArrayType_/_ArraySize_/_ArrayData_</span> <span class="pl-c"><span class="pl-c">%</span> JData tags to store ND array to preserve data types; use 'prefix' to customize variable name prefix</span> encodedmat<span class="pl-k">=</span>jdataencode(single(magic(<span class="pl-c1">5</span>)),<span class="pl-s"><span class="pl-pds">'</span>annotatearray<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>,<span class="pl-s"><span class="pl-pds">'</span>prefix<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>x<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> when setting 'usearrayshape' to 1, jdataencode can use _ArrayShape_ to encode special matrices</span> encodedtoeplitz<span class="pl-k">=</span>jdataencode(uint8(toeplitz([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>,<span class="pl-c1">4</span>],[<span class="pl-c1">1</span>,<span class="pl-c1">5</span>,<span class="pl-c1">6</span>])),<span class="pl-s"><span class="pl-pds">'</span>usearrayshape<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>)</pre></div> <h3>jdatadecode.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% jdatadecode does the opposite to jdataencode, it recognizes JData annotations and convert % those back to MATLAB native data structures, such as ND-arrays, tables, graph etc rawdata=struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5)); jd=jdataencode(rawdata) newjd=jdatadecode(jd) % we can test that the decoded data are the same as the original isequaln(newjd,rawdata) % if one uses jsondecode to parse a JSON object, the output JData annotation name prefix is different % jsondecode adds &quot;x_&quot; as prefix rawdecode_builtin = jsondecode(savejson('',rawdata)); rawdecode_builtin.a finaldecode=jdatadecode(rawdecode_builtin) % in comparison, loadjson calls encodevarname.m, producing &quot;x0x5F_&quot; as prefix (hex for '_') % encodevarname encoded names can be reversed to original decodevarname.m rawdecode_jsonlab = loadjson(savejson('',rawdata), 'jdatadecode', 0); rawdecode_jsonlab.a finaldecode=jdatadecode(rawdecode_jsonlab)"><pre><span class="pl-c"><span class="pl-c">%</span> jdatadecode does the opposite to jdataencode, it recognizes JData annotations and convert</span> <span class="pl-c"><span class="pl-c">%</span> those back to MATLAB native data structures, such as ND-arrays, tables, graph etc</span> rawdata<span class="pl-k">=</span>struct(<span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>,rand(<span class="pl-c1">5</span>)+<span class="pl-c1">1<span class="pl-k">i</span></span><span class="pl-k">*</span>rand(<span class="pl-c1">5</span>),<span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>,[],<span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>,sparse(<span class="pl-c1">5</span>,<span class="pl-c1">5</span>)); jd<span class="pl-k">=</span>jdataencode(<span class="pl-smi">rawdata</span>) newjd<span class="pl-k">=</span>jdatadecode(<span class="pl-smi">jd</span>) <span class="pl-c"><span class="pl-c">%</span> we can test that the decoded data are the same as the original</span> isequaln(<span class="pl-smi">newjd</span>,<span class="pl-smi">rawdata</span>) <span class="pl-c"><span class="pl-c">%</span> if one uses jsondecode to parse a JSON object, the output JData annotation name prefix is different</span> <span class="pl-c"><span class="pl-c">%</span> jsondecode adds "x_" as prefix</span> rawdecode_builtin <span class="pl-k">=</span> jsondecode(savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">rawdata</span>)); <span class="pl-smi">rawdecode_builtin</span>.<span class="pl-smi">a</span> finaldecode<span class="pl-k">=</span>jdatadecode(<span class="pl-smi">rawdecode_builtin</span>) <span class="pl-c"><span class="pl-c">%</span> in comparison, loadjson calls encodevarname.m, producing "x0x5F_" as prefix (hex for '_')</span> <span class="pl-c"><span class="pl-c">%</span> encodevarname encoded names can be reversed to original decodevarname.m</span> rawdecode_jsonlab <span class="pl-k">=</span> loadjson(savejson(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>,<span class="pl-smi">rawdata</span>), <span class="pl-s"><span class="pl-pds">'</span>jdatadecode<span class="pl-pds">'</span></span>, <span class="pl-c1">0</span>); <span class="pl-smi">rawdecode_jsonlab</span>.<span class="pl-smi">a</span> finaldecode<span class="pl-k">=</span>jdatadecode(<span class="pl-smi">rawdecode_jsonlab</span>)</pre></div> <h3>savejd.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% savejd is a unified interface for savejson/savebj/savemsgpack/saveh5 depending on the output file suffix a={single(rand(2)), struct('va',1,'vb','string'), 1+2i}; savejd('', a, 'test.json') savejd('', a, 'test.jdb') savejd('', a, 'test.ubj') savejd('', a, 'test.h5')"><pre><span class="pl-c"><span class="pl-c">%</span> savejd is a unified interface for savejson/savebj/savemsgpack/saveh5 depending on the output file suffix</span> a<span class="pl-k">=</span>{single(rand(<span class="pl-c1">2</span>)), struct(<span class="pl-s"><span class="pl-pds">'</span>va<span class="pl-pds">'</span></span>,<span class="pl-c1">1</span>,<span class="pl-s"><span class="pl-pds">'</span>vb<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>string<span class="pl-pds">'</span></span>), <span class="pl-c1">1</span><span class="pl-k">+</span><span class="pl-c1">2<span class="pl-k">i</span></span>}; savejd(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>, <span class="pl-smi">a</span>, <span class="pl-s"><span class="pl-pds">'</span>test.json<span class="pl-pds">'</span></span>) savejd(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>, <span class="pl-smi">a</span>, <span class="pl-s"><span class="pl-pds">'</span>test.jdb<span class="pl-pds">'</span></span>) savejd(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>, <span class="pl-smi">a</span>, <span class="pl-s"><span class="pl-pds">'</span>test.ubj<span class="pl-pds">'</span></span>) savejd(<span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span>, <span class="pl-smi">a</span>, <span class="pl-s"><span class="pl-pds">'</span>test.h5<span class="pl-pds">'</span></span>)</pre></div> <h3>loadjd.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% loadjd is a unified interface for loadjson/loadbj/loadmsgpack/loadh5/load/loadjnifti depending on the input file suffix % supported types include .json,.jnii,.jdt,.jmsh,.jnirs,.jbids,.bjd,.bnii,.jdb,.bmsh,.bnirs,.ubj,.msgpack, % .h5,.hdf5,.snirf,.pmat,.nwb,.nii,.nii.gz,.tsv,.tsv.gz,.csv,.csv.gz,.mat,.bvec,.bval; input can be an URL data = loadjd('test.json'); data = loadjd('test.jdb'); data = loadjd('test.ubj'); data = loadjd('test.h5'); data = loadjd('file:///path/to/test.jnii'); data = loadjd('https://neurojson.org/io/stat.cgi?action=get&amp;db=abide&amp;doc=CMU_b&amp;file=0a429cb9101b733f594eefc1261d6985-zlib.bnii');"><pre><span class="pl-c"><span class="pl-c">%</span> loadjd is a unified interface for loadjson/loadbj/loadmsgpack/loadh5/load/loadjnifti depending on the input file suffix</span> <span class="pl-c"><span class="pl-c">%</span> supported types include .json,.jnii,.jdt,.jmsh,.jnirs,.jbids,.bjd,.bnii,.jdb,.bmsh,.bnirs,.ubj,.msgpack,</span> <span class="pl-c"><span class="pl-c">%</span> .h5,.hdf5,.snirf,.pmat,.nwb,.nii,.nii.gz,.tsv,.tsv.gz,.csv,.csv.gz,.mat,.bvec,.bval; input can be an URL</span> data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>test.json<span class="pl-pds">'</span></span>); data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>test.jdb<span class="pl-pds">'</span></span>); data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>test.ubj<span class="pl-pds">'</span></span>); data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>test.h5<span class="pl-pds">'</span></span>); data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>file:///path/to/test.jnii<span class="pl-pds">'</span></span>); data <span class="pl-k">=</span> loadjd(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.org/io/stat.cgi?action=get&amp;db=abide&amp;doc=CMU_b&amp;file=0a429cb9101b733f594eefc1261d6985-zlib.bnii<span class="pl-pds">'</span></span>);</pre></div> <h3>jsonget.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% loadjson/loadbj JSON-memory-map (mmap) output returned by loadjson or loadbj % each mmap contains a pair of JSONPath and two numbers [offset, length] of the object in bytes in the buffer/file jsonstr = '{&quot;obj&quot;:{&quot;string&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}'; mmap=loadjson(jsonstr, 'mmaponly', 1) % mmap = [ [&quot;$&quot;,[1,42]], [&quot;$.obj&quot;,[8,34]], [&quot;$.obj.string&quot;,[18,7]], [&quot;$.obj.array&quot;,[34,7]] ] % this means there are 4 objects, root '$', with its content starting byte 1, with a length of 42 bytes; % content of object '$.obj' starts byte 8, with a length of 34 bytes mmap{:} % using the above mmap, jsonget can return any raw data without needing to reparse jsonstr % below command returns '[1,2,3]' as a string by following the offset/length data in mmap jsonget(jsonstr, mmap, '$.obj.array') % you can request multiple objects by giving multiple JSONPath keys jsonget(jsonstr, mmap, '$.obj', '$.obj.string') % you can request multiple objects by giving multiple JSONPath keys jsonget(jsonstr, mmap, '$.obj', '$.obj.string') % jsonget not only can fast reading a JSON string buffer, it can also do disk-map read of a file mmap = loadjson('/path/to/data.json', 'mmaponly', 1); jsonget('/path/to/data.json', mmap, '$.obj')"><pre><span class="pl-c"><span class="pl-c">%</span> loadjson/loadbj JSON-memory-map (mmap) output returned by loadjson or loadbj</span> <span class="pl-c"><span class="pl-c">%</span> each mmap contains a pair of JSONPath and two numbers [offset, length] of the object in bytes in the buffer/file</span> jsonstr <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">'</span>{"obj":{"string":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>; mmap<span class="pl-k">=</span>loadjson(<span class="pl-smi">jsonstr</span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> mmap = [ ["$",[1,42]], ["$.obj",[8,34]], ["$.obj.string",[18,7]], ["$.obj.array",[34,7]] ]</span> <span class="pl-c"><span class="pl-c">%</span> this means there are 4 objects, root '$', with its content starting byte 1, with a length of 42 bytes;</span> <span class="pl-c"><span class="pl-c">%</span> content of object '$.obj' starts byte 8, with a length of 34 bytes</span> mmap{<span class="pl-k">:</span>} <span class="pl-c"><span class="pl-c">%</span> using the above mmap, jsonget can return any raw data without needing to reparse jsonstr</span> <span class="pl-c"><span class="pl-c">%</span> below command returns '[1,2,3]' as a string by following the offset/length data in mmap</span> jsonget(<span class="pl-smi">jsonstr</span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> you can request multiple objects by giving multiple JSONPath keys</span> jsonget(<span class="pl-smi">jsonstr</span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.string<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> you can request multiple objects by giving multiple JSONPath keys</span> jsonget(<span class="pl-smi">jsonstr</span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.string<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> jsonget not only can fast reading a JSON string buffer, it can also do disk-map read of a file</span> mmap <span class="pl-k">=</span> loadjson(<span class="pl-s"><span class="pl-pds">'</span>/path/to/data.json<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>); jsonget(<span class="pl-s"><span class="pl-pds">'</span>/path/to/data.json<span class="pl-pds">'</span></span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj<span class="pl-pds">'</span></span>)</pre></div> <h3>jsonset.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% using JSON mmap, one can rapidly modify the content of JSON object pointed by a path jsonstr = '{&quot;obj&quot;:{&quot;string&quot;:&quot;value&quot;,&quot;array&quot;:[1,2,3]}}'; mmap=loadjson(jsonstr, 'mmaponly', 1) % we can rewrite object $.obj.array by changing its value '[1,2,3]' to a string &quot;test&quot; % this returns the updated jsonstr as '{&quot;obj&quot;:{&quot;string&quot;:&quot;value&quot;,&quot;array&quot;:&quot;test&quot; }}' % the new value of a key must not have longer bytes than the original value jsonset(jsonstr, mmap, '$.obj.array', '&quot;test&quot;') % one can change multiple JSON objects, below returns '{&quot;obj&quot;:{&quot;string&quot;:&quot;new&quot; ,&quot;array&quot;:[] }}' jsonset(jsonstr, mmap, '$.obj.string', '&quot;new&quot;', '$.obj.array', '[]') % if mmap is parsed from a file, jsonset can perform disk-map like fast writing to modify the json content mmap = loadjson('/path/to/data.json', 'mmaponly', 1); jsonset('/path/to/data.json', mmap, '$.obj.string', '&quot;new&quot;', '$.obj.array', '[]')"><pre><span class="pl-c"><span class="pl-c">%</span> using JSON mmap, one can rapidly modify the content of JSON object pointed by a path</span> jsonstr <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">'</span>{"obj":{"string":"value","array":[1,2,3]}}<span class="pl-pds">'</span></span>; mmap<span class="pl-k">=</span>loadjson(<span class="pl-smi">jsonstr</span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>) <span class="pl-c"><span class="pl-c">%</span> we can rewrite object $.obj.array by changing its value '[1,2,3]' to a string "test"</span> <span class="pl-c"><span class="pl-c">%</span> this returns the updated jsonstr as '{"obj":{"string":"value","array":"test" }}'</span> <span class="pl-c"><span class="pl-c">%</span> the new value of a key must not have longer bytes than the original value</span> jsonset(<span class="pl-smi">jsonstr</span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>"test"<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> one can change multiple JSON objects, below returns '{"obj":{"string":"new" ,"array":[] }}'</span> jsonset(<span class="pl-smi">jsonstr</span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.string<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>"new"<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>[]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> if mmap is parsed from a file, jsonset can perform disk-map like fast writing to modify the json content</span> mmap <span class="pl-k">=</span> loadjson(<span class="pl-s"><span class="pl-pds">'</span>/path/to/data.json<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>mmaponly<span class="pl-pds">'</span></span>, <span class="pl-c1">1</span>); jsonset(<span class="pl-s"><span class="pl-pds">'</span>/path/to/data.json<span class="pl-pds">'</span></span>, <span class="pl-smi">mmap</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.string<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>"new"<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>[]<span class="pl-pds">'</span></span>)</pre></div> <h3>jsonpath.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% JSONPath is a widely supported standard to index/search a large struct, such as those loaded from a JSON file % the jsonpath.m function implements a subset of the features % the below command returns the value of obj.key subfield, which is &quot;value&quot; obj = loadjson('{&quot;obj&quot;:{&quot;key&quot;:&quot;value1&quot;,&quot;array&quot;:[1,2,3],&quot;sub&quot;:{&quot;key&quot;:&quot;value2&quot;,&quot;array&quot;:[]}}}'); jsonpath(obj, '$.obj.key') % using [] operator, one can also index array elements, index start from 0; the output below is 2 jsonpath(obj, '$.obj.array[1]') % [] operator supports range, for example below commands yields [1,2] jsonpath(obj, '$.obj.array[0:1]') % a negative index in [] counting elements backwards, -1 means the last element jsonpath(obj, '$.obj.array[-1]') % jsonpath.m supports JSONPath's deep-scan operator '..', it traverses through the struct % and find all keys following .., here the output is {&quot;value1&quot;, &quot;value2&quot;} jsonpath(obj, '$.obj..key') % you can further concatenate JSONPath operators to select outputs from the earlier ones, this outputs {'value2'} jsonpath(obj, '$.obj..key[1]') % instead of .keyname, you can use [keyname], below command is the same as above jsonpath(obj, '$[obj]..[key][1]') % one can escape special char, such as &quot;.&quot;, in the key using special\.key or [special.key] jsonpath(obj, '$.obj.special\.key.sub')"><pre><span class="pl-c"><span class="pl-c">%</span> JSONPath is a widely supported standard to index/search a large struct, such as those loaded from a JSON file</span> <span class="pl-c"><span class="pl-c">%</span> the jsonpath.m function implements a subset of the features</span> <span class="pl-c"><span class="pl-c">%</span> the below command returns the value of obj.key subfield, which is "value"</span> obj <span class="pl-k">=</span> loadjson(<span class="pl-s"><span class="pl-pds">'</span>{"obj":{"key":"value1","array":[1,2,3],"sub":{"key":"value2","array":[]}}}<span class="pl-pds">'</span></span>); jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.key<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> using [] operator, one can also index array elements, index start from 0; the output below is 2</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array[1]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> [] operator supports range, for example below commands yields [1,2]</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array[0:1]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> a negative index in [] counting elements backwards, -1 means the last element</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.array[-1]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> jsonpath.m supports JSONPath's deep-scan operator '..', it traverses through the struct</span> <span class="pl-c"><span class="pl-c">%</span> and find all keys following .., here the output is {"value1", "value2"}</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj..key<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> you can further concatenate JSONPath operators to select outputs from the earlier ones, this outputs {'value2'}</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj..key[1]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> instead of .keyname, you can use [keyname], below command is the same as above</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$[obj]..[key][1]<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> one can escape special char, such as ".", in the key using special\.key or [special.key]</span> jsonpath(<span class="pl-smi">obj</span>, <span class="pl-s"><span class="pl-pds">'</span>$.obj.special\.key.sub<span class="pl-pds">'</span></span>)</pre></div> <h3>jsoncache.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% the _DataLink_ annotation in the JData specification permits linking of external data files % in a JSON file - to make downloading/parsing externally linked data files efficient, such as % processing large neuroimaging datasets hosted on http://neurojson.io, we have developed a system % to download files on-demand and cache those locally. jsoncache.m is responsible of searching % the local cache folders, if found the requested file, it returns the path to the local cache; % if not found, it returns a SHA-256 hash of the URL as the file name, and the possible cache folders % % When loading a file from URL, below is the order of cache file search paths, ranking in search order % % global-variable NEUROJSON_CACHE | if defined, this path will be searched first % [pwd '/.neurojson'] | on all OSes % /home/USERNAME/.neurojson | on all OSes (per-user) % /home/USERNAME/.cache/neurojson | if on Linux (per-user) % /var/cache/neurojson | if on Linux (system wide) % /home/USERNAME/Library/neurojson| if on MacOS (per-user) % /Library/neurojson | if on MacOS (system wide) % C:\ProgramData\neurojson | if on Windows (system wide) % % When saving a file from a URL, under the root cache folder, subfolders can be created; % if the URL is one of a standard NeuroJSON.io URLs as below % % https://neurojson.org/io/stat.cgi?action=get&amp;db=DBNAME&amp;doc=DOCNAME&amp;file=sub-01/anat/datafile.nii.gz % https://neurojson.io:7777/DBNAME/DOCNAME % https://neurojson.io:7777/DBNAME/DOCNAME/datafile.suffix % % the file datafile.nii.gz will be downloaded to /home/USERNAME/.neurojson/io/DBNAME/DOCNAME/sub-01/anat/ folder % if a URL does not follow the neurojson.io format, the cache folder has the below form % % CACHEFOLDER{i}/domainname.com/XX/YY/XXYYZZZZ... % % where XXYYZZZZ.. is the SHA-256 hash of the full URL, XX is the first two digit, YY is the 3-4 digits % below command searches CACHEFOLDER{i}/io/openneuro/ds000001/sub-01/anat/, and return the path/filename [cachepath, filename] = jsoncache('https://neurojson.org/io/stat.cgi?action=get&amp;db=openneuro&amp;doc=ds000001&amp;file=sub-01/anat/sub-01_inplaneT2.nii.gz&amp;size=669578') % this searches CACHEFOLDER{i}/raw.githubusercontent.com/55/d2, and the filename is 55d24a4bad6ecc3f5dc4d333be728e01c26b696ef7bc5dd0861b7fa672a28e8e.json [cachepath, filename] = jsoncache('https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json') % this searches cachefolder{i}/io/adhd200/Brown folder, and look for file Brown.json [cachepath, filename] = jsoncache('https://neurojson.io:7777/adhd200/Brown') % this searches cachefolder{i}/io/openneuro/ds003805 folder, and look for file ds003805.json [cachepath, filename] = jsoncache('https://neurojson.io:7777/openneuro/ds003805')"><pre><span class="pl-c"><span class="pl-c">%</span> the _DataLink_ annotation in the JData specification permits linking of external data files</span> <span class="pl-c"><span class="pl-c">%</span> in a JSON file - to make downloading/parsing externally linked data files efficient, such as</span> <span class="pl-c"><span class="pl-c">%</span> processing large neuroimaging datasets hosted on http://neurojson.io, we have developed a system</span> <span class="pl-c"><span class="pl-c">%</span> to download files on-demand and cache those locally. jsoncache.m is responsible of searching</span> <span class="pl-c"><span class="pl-c">%</span> the local cache folders, if found the requested file, it returns the path to the local cache;</span> <span class="pl-c"><span class="pl-c">%</span> if not found, it returns a SHA-256 hash of the URL as the file name, and the possible cache folders</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> When loading a file from URL, below is the order of cache file search paths, ranking in search order</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> global-variable NEUROJSON_CACHE | if defined, this path will be searched first</span> <span class="pl-c"><span class="pl-c">%</span> [pwd '/.neurojson'] | on all OSes</span> <span class="pl-c"><span class="pl-c">%</span> /home/USERNAME/.neurojson | on all OSes (per-user)</span> <span class="pl-c"><span class="pl-c">%</span> /home/USERNAME/.cache/neurojson | if on Linux (per-user)</span> <span class="pl-c"><span class="pl-c">%</span> /var/cache/neurojson | if on Linux (system wide)</span> <span class="pl-c"><span class="pl-c">%</span> /home/USERNAME/Library/neurojson| if on MacOS (per-user)</span> <span class="pl-c"><span class="pl-c">%</span> /Library/neurojson | if on MacOS (system wide)</span> <span class="pl-c"><span class="pl-c">%</span> C:\ProgramData\neurojson | if on Windows (system wide)</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> When saving a file from a URL, under the root cache folder, subfolders can be created;</span> <span class="pl-c"><span class="pl-c">%</span> if the URL is one of a standard NeuroJSON.io URLs as below</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> https://neurojson.org/io/stat.cgi?action=get&amp;db=DBNAME&amp;doc=DOCNAME&amp;file=sub-01/anat/datafile.nii.gz</span> <span class="pl-c"><span class="pl-c">%</span> https://neurojson.io:7777/DBNAME/DOCNAME</span> <span class="pl-c"><span class="pl-c">%</span> https://neurojson.io:7777/DBNAME/DOCNAME/datafile.suffix</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> the file datafile.nii.gz will be downloaded to /home/USERNAME/.neurojson/io/DBNAME/DOCNAME/sub-01/anat/ folder</span> <span class="pl-c"><span class="pl-c">%</span> if a URL does not follow the neurojson.io format, the cache folder has the below form</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> CACHEFOLDER{i}/domainname.com/XX/YY/XXYYZZZZ...</span> <span class="pl-c"><span class="pl-c">%</span></span> <span class="pl-c"><span class="pl-c">%</span> where XXYYZZZZ.. is the SHA-256 hash of the full URL, XX is the first two digit, YY is the 3-4 digits</span> <span class="pl-c"><span class="pl-c">%</span> below command searches CACHEFOLDER{i}/io/openneuro/ds000001/sub-01/anat/, and return the path/filename</span> [<span class="pl-smi">cachepath</span>, <span class="pl-smi">filename</span>] <span class="pl-k">=</span> jsoncache(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.org/io/stat.cgi?action=get&amp;db=openneuro&amp;doc=ds000001&amp;file=sub-01/anat/sub-01_inplaneT2.nii.gz&amp;size=669578<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> this searches CACHEFOLDER{i}/raw.githubusercontent.com/55/d2, and the filename is 55d24a4bad6ecc3f5dc4d333be728e01c26b696ef7bc5dd0861b7fa672a28e8e.json</span> [<span class="pl-smi">cachepath</span>, <span class="pl-smi">filename</span>] <span class="pl-k">=</span> jsoncache(<span class="pl-s"><span class="pl-pds">'</span>https://raw.githubusercontent.com/fangq/jsonlab/master/examples/example1.json<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> this searches cachefolder{i}/io/adhd200/Brown folder, and look for file Brown.json</span> [<span class="pl-smi">cachepath</span>, <span class="pl-smi">filename</span>] <span class="pl-k">=</span> jsoncache(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.io:7777/adhd200/Brown<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> this searches cachefolder{i}/io/openneuro/ds003805 folder, and look for file ds003805.json</span> [<span class="pl-smi">cachepath</span>, <span class="pl-smi">filename</span>] <span class="pl-k">=</span> jsoncache(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.io:7777/openneuro/ds003805<span class="pl-pds">'</span></span>)</pre></div> <h3>jdlink.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% jdlink dynamically downloads, caches and parses data files from one or multiple URLs % jdlink calls jsoncache to scan cache folders first, if a cache copy exists, it loads the cache first % here we download a dataset from NeuroJSON.io, containing many linked data files data = loadjson('https://neurojson.io:7777/openneuro/ds000001'); % we now use jsonpath to scan all linked resources under subfolder &quot;anat&quot; alllinks = jsonpath(data, '$..anat.._DataLink_') % let's download all linked nifti files (total 4) for sub-01 and sub-02, and load the files as niidata niidata = jdlink(alllinks, 'regex', 'sub-0[12]_.*\.nii'); % if you just want to download/cache all files and do not want to parse the files, you can run jdlink(alllinks);"><pre><span class="pl-c"><span class="pl-c">%</span> jdlink dynamically downloads, caches and parses data files from one or multiple URLs</span> <span class="pl-c"><span class="pl-c">%</span> jdlink calls jsoncache to scan cache folders first, if a cache copy exists, it loads the cache first</span> <span class="pl-c"><span class="pl-c">%</span> here we download a dataset from NeuroJSON.io, containing many linked data files</span> data <span class="pl-k">=</span> loadjson(<span class="pl-s"><span class="pl-pds">'</span>https://neurojson.io:7777/openneuro/ds000001<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">%</span> we now use jsonpath to scan all linked resources under subfolder "anat"</span> alllinks <span class="pl-k">=</span> jsonpath(<span class="pl-smi">data</span>, <span class="pl-s"><span class="pl-pds">'</span>$..anat.._DataLink_<span class="pl-pds">'</span></span>) <span class="pl-c"><span class="pl-c">%</span> let's download all linked nifti files (total 4) for sub-01 and sub-02, and load the files as niidata</span> niidata <span class="pl-k">=</span> jdlink(<span class="pl-smi">alllinks</span>, <span class="pl-s"><span class="pl-pds">'</span>regex<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>sub-0[12]_.*\.nii<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">%</span> if you just want to download/cache all files and do not want to parse the files, you can run</span> jdlink(<span class="pl-smi">alllinks</span>);</pre></div> <h3>examples</h3> <p>Under the <code>examples</code> folder, you can find several scripts to demonstrate the basic utilities of JSONLab. Running the <code>demo_jsonlab_basic.m</code> script, you will see the conversions from MATLAB data structure to JSON text and backward. In <code>jsonlab_selftest.m</code>, we load complex JSON files downloaded from the Internet and validate the <code>loadjson/savejson</code> functions for regression testing purposes. Similarly, a <code>demo_ubjson_basic.m</code> script is provided to test the <code>saveubjson</code> and <code>loadubjson</code> functions for various matlab data structures, and <code>demo_msgpack_basic.m</code> is for testing <code>savemsgpack</code> and <code>loadmsgpack</code>.</p> <p>Please run these examples and understand how JSONLab works before you use it to process your data.</p> <h3>unit testing</h3> <p>Under the <code>test</code> folder, you can find a script to test individual data types and inputs using various encoders and decoders. This unit testing script also serves as a <strong>specification validator</strong> to the JSONLab functions and ensure that the outputs are compliant to the underlying specifications.</p> <h2>In-memory data compression/decompression</h2> <p>JSONLab contains a set of functions to perform in-memory buffer data compression and decompression</p> <h3>Data Compression: {zlib,gzip,base64,lzma,lzip,lz4,lz4hc,zstd,blosc2}encode.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% MATLAB running with jvm provides zlib and gzip compression natively % one can also install ZMat (https://github.com/NeuroJSON/zmat) to do zlib(.zip) or gzip (.gz) compression output = zlibencode(diag([1,2,3,4])) [output, info] = zlibencode(uint8(magic(8))) outputbase64 = char(base64encode(output(:))) % char, numeric and logical ND-arrays are acceptable inputs to the compression functions [output, info] = gzipencode(uint8(magic(8))) % setting a negative integer between -1 to -9 to set compression level: -9 being the highest [output, info] = zlibencode(uint8(magic(8)), -9) % other advanced compressions are supported but requires ZMat % lzma offers the highest compression rate, but slow compresison speed output = lzmaencode(uint8(magic(8))) % lz4 offers the fastest compression speed, but slightly low compression ratio output = lz4encode(peaks(10)) output = lz4hcencode(uint8(magic(8))) % zstd has a good balanced speed/ratio, similar to zlib output = zstdencode(peaks(10)) output = zstdencode(peaks(10), -9)"><pre><span class="pl-c"><span class="pl-c">%</span> MATLAB running with jvm provides zlib and gzip compression natively</span> <span class="pl-c"><span class="pl-c">%</span> one can also install ZMat (https://github.com/NeuroJSON/zmat) to do zlib(.zip) or gzip (.gz) compression</span> output <span class="pl-k">=</span> zlibencode(diag([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>,<span class="pl-c1">4</span>])) [<span class="pl-smi">output</span>, <span class="pl-smi">info</span>] <span class="pl-k">=</span> zlibencode(uint8(magic(<span class="pl-c1">8</span>))) outputbase64 <span class="pl-k">=</span> char(base64encode(output(<span class="pl-k">:</span>))) <span class="pl-c"><span class="pl-c">%</span> char, numeric and logical ND-arrays are acceptable inputs to the compression functions</span> [<span class="pl-smi">output</span>, <span class="pl-smi">info</span>] <span class="pl-k">=</span> gzipencode(uint8(magic(<span class="pl-c1">8</span>))) <span class="pl-c"><span class="pl-c">%</span> setting a negative integer between -1 to -9 to set compression level: -9 being the highest</span> [<span class="pl-smi">output</span>, <span class="pl-smi">info</span>] <span class="pl-k">=</span> zlibencode(uint8(magic(<span class="pl-c1">8</span>)), <span class="pl-k">-</span><span class="pl-c1">9</span>) <span class="pl-c"><span class="pl-c">%</span> other advanced compressions are supported but requires ZMat</span> <span class="pl-c"><span class="pl-c">%</span> lzma offers the highest compression rate, but slow compresison speed</span> output <span class="pl-k">=</span> lzmaencode(uint8(magic(<span class="pl-c1">8</span>))) <span class="pl-c"><span class="pl-c">%</span> lz4 offers the fastest compression speed, but slightly low compression ratio</span> output <span class="pl-k">=</span> lz4encode(peaks(<span class="pl-c1">10</span>)) output <span class="pl-k">=</span> lz4hcencode(uint8(magic(<span class="pl-c1">8</span>))) <span class="pl-c"><span class="pl-c">%</span> zstd has a good balanced speed/ratio, similar to zlib</span> output <span class="pl-k">=</span> zstdencode(peaks(<span class="pl-c1">10</span>)) output <span class="pl-k">=</span> zstdencode(peaks(<span class="pl-c1">10</span>), <span class="pl-k">-</span><span class="pl-c1">9</span>)</pre></div> <h3>Data Deompression: {zlib,gzip,base64,lzma,lzip,lz4,lz4hc,zstd,blosc2}decode.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% passing on a compressed byte-array buffer to *decode function decompresses the buffer [compressed, info] = zlibencode(eye(10)); % the decompressed buffer is a byte-array decompressd = zlibdecode(compressed); % to fully recover the original data structure, one most use the info struct returned by the compressor decompressd = zlibdecode(compressed, info) % if one passes a zlib compressed buffer to a different decompressor, an error is reported decompressd = gzipdecode(compressed, info) outputbase64 = char(base64decode(base64encode('jsonlab test')))"><pre><span class="pl-c"><span class="pl-c">%</span> passing on a compressed byte-array buffer to *decode function decompresses the buffer</span> [<span class="pl-smi">compressed</span>, <span class="pl-smi">info</span>] <span class="pl-k">=</span> zlibencode(eye(<span class="pl-c1">10</span>)); <span class="pl-c"><span class="pl-c">%</span> the decompressed buffer is a byte-array</span> decompressd <span class="pl-k">=</span> zlibdecode(<span class="pl-smi">compressed</span>); <span class="pl-c"><span class="pl-c">%</span> to fully recover the original data structure, one most use the info struct returned by the compressor</span> decompressd <span class="pl-k">=</span> zlibdecode(<span class="pl-smi">compressed</span>, <span class="pl-smi">info</span>) <span class="pl-c"><span class="pl-c">%</span> if one passes a zlib compressed buffer to a different decompressor, an error is reported</span> decompressd <span class="pl-k">=</span> gzipdecode(<span class="pl-smi">compressed</span>, <span class="pl-smi">info</span>) outputbase64 <span class="pl-k">=</span> char(base64decode(base64encode(<span class="pl-s"><span class="pl-pds">'</span>jsonlab test<span class="pl-pds">'</span></span>)))</pre></div> <h2>Using <code>jsave/jload</code> to share workspace</h2> <p>Starting from JSONLab v2.0, we provide a pair of functions, <code>jsave/jload</code> to store and retrieve variables from the current workspace, similar to the <code>save/load</code> functions in MATLAB and Octave. The files that <code>jsave/jload</code> reads/writes is by default a binary JData file with a suffix <code>.pmat</code>. The file size is comparable (can be smaller if use <code>lzma</code> compression) to <code>.mat</code> files. This feature is currently experimental.</p> <p>The main benefits of using .pmat file to share matlab variables include</p> <ul> <li>a <code>.pmat</code> file can be 50% smaller than a <code>.mat</code> file when using <code>jsave(..., "compression","lzma")</code>; the only drawback is longer saving time.</li> <li>a <code>.pmat</code> file can be readily read/opened among many programming environments, including Python, JavaScript, Go, Java etc, where .mat file support is not generally available. Parsers of <code>.pmat</code> files are largely compatible with BJData's parsers available at <a href="https://neurojson.org/#software" rel="nofollow">https://neurojson.org/#software</a></li> <li>a <code>.pmat</code> file is quasi-human-readable, one can see the internal data fields even in a command line, for example using <code>strings -n 2 file.pmat | astyle</code>, making the binary data easy to be understood, shared and reused.</li> <li><code>jsave/jload</code> can also use MessagePack and JSON formats as the underlying data storage format, addressing needs from a diverse set of applications. MessagePack parsers are readily available at <a href="https://msgpack.org/" rel="nofollow">https://msgpack.org/</a></li> </ul> <h3>jsave.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="jsave % save the current workspace to default.pmat jsave mydata.pmat jsave('mydata.pmat','vars',{'var1','var2'}) jsave('mydata.pmat','compression','lzma') jsave('mydata.json','compression','gzip')"><pre><span class="pl-smi">jsave</span> <span class="pl-c"><span class="pl-c">%</span> save the current workspace to default.pmat</span> <span class="pl-en">jsave</span> <span class="pl-s">mydata.pmat</span> jsave(<span class="pl-s"><span class="pl-pds">'</span>mydata.pmat<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>vars<span class="pl-pds">'</span></span>,{<span class="pl-s"><span class="pl-pds">'</span>var1<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>var2<span class="pl-pds">'</span></span>}) jsave(<span class="pl-s"><span class="pl-pds">'</span>mydata.pmat<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>lzma<span class="pl-pds">'</span></span>) jsave(<span class="pl-s"><span class="pl-pds">'</span>mydata.json<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>compression<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>gzip<span class="pl-pds">'</span></span>)</pre></div> <h3>jload.m</h3> <div class="highlight highlight-source-matlab notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="jload % load variables from default.pmat to the current workspace jload mydata.pmat % load variables from mydata.pmat vars=jload('mydata.pmat','vars',{'var1','var2'}) % return vars.var1, vars.var2 jload('mydata.pmat','simplifycell',0) jload('mydata.json')"><pre><span class="pl-smi">jload</span> <span class="pl-c"><span class="pl-c">%</span> load variables from default.pmat to the current workspace</span> <span class="pl-en">jload</span> <span class="pl-s">mydata.pmat </span><span class="pl-c"><span class="pl-c">%</span> load variables from mydata.pmat</span> vars<span class="pl-k">=</span>jload(<span class="pl-s"><span class="pl-pds">'</span>mydata.pmat<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>vars<span class="pl-pds">'</span></span>,{<span class="pl-s"><span class="pl-pds">'</span>var1<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>var2<span class="pl-pds">'</span></span>}) <span class="pl-c"><span class="pl-c">%</span> return vars.var1, vars.var2</span> jload(<span class="pl-s"><span class="pl-pds">'</span>mydata.pmat<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">'</span>simplifycell<span class="pl-pds">'</span></span>,<span class="pl-c1">0</span>) jload(<span class="pl-s"><span class="pl-pds">'</span>mydata.json<span class="pl-pds">'</span></span>)</pre></div> <h2>Sharing JSONLab created data files in Python</h2> <p>Despite the use of portable data annotation defined by the JData Specification, the output JSON files created by JSONLab are 100% JSON compatible (with the exception that long strings may be broken into multiple lines for better readability). Therefore, JSONLab-created JSON files (<code>.json, .jnii, .jnirs</code> etc) can be readily read and written by nearly all existing JSON parsers, including the built-in <code>json</code> module parser in Python.</p> <p>However, we strongly recommend one to use a lightweight <code>jdata</code> module, developed by the same author, to perform the extra JData encoding and decoding and convert JSON data directly to convenient Python/Numpy data structures. The <code>jdata</code> module can also directly read/write UBJSON/Binary JData outputs from JSONLab (<code>.bjd, .ubj, .bnii, .bnirs, .pmat</code> etc). Using binary JData files are expected to produce much smaller file sizes and faster parsing, while maintaining excellent portability and generality.</p> <p>In short, to conveniently read/write data files created by JSONLab into Python, whether they are JSON based or binary JData/UBJSON based, one just need to download the below two light-weight python modules:</p> <ul> <li><strong>jdata</strong>: PyPi: <a href="https://pypi.org/project/jdata/" rel="nofollow">https://pypi.org/project/jdata/</a> ; Github: <a href="https://github.com/NeuroJSON/pyjdata">https://github.com/NeuroJSON/pyjdata</a></li> <li><strong>bjdata</strong> PyPi: <a href="https://pypi.org/project/bjdata/" rel="nofollow">https://pypi.org/project/bjdata/</a> ; Github: <a href="https://github.com/NeuroJSON/pybj">https://github.com/NeuroJSON/pybj</a></li> </ul> <p>To install these modules on Python 2.x, please first check if your system has <code>pip</code> and <code>numpy</code>, if not, please install it by running (using Ubuntu/Debian as example)</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo apt-get install python-pip python3-pip python-numpy python3-numpy"><pre>sudo apt-get install python-pip python3-pip python-numpy python3-numpy</pre></div> <p>After the installation is done, one can then install the <code>jdata</code> and <code>bjdata</code> modules by</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pip install jdata --user pip install bjdata --user"><pre>pip install jdata --user pip install bjdata --user</pre></div> <p>To install these modules for Python 3.x, please replace <code>pip</code> by <code>pip3</code>. If one prefers to install these modules globally for all users, simply execute the above commands using</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo pip install jdata sudo pip install bjdata"><pre>sudo pip install jdata sudo pip install bjdata</pre></div> <p>The above modules require built-in Python modules <code>json</code> and NumPy (<code>numpy</code>).</p> <p>Once the necessary modules are installed, one can type <code>python</code> (or <code>python3</code>), and run</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import jdata as jd import numpy as np data1=jd.loadt('myfile.json'); data2=jd.loadb('myfile.bjd'); data3=jd.loadb('myfile.pmat');"><pre><span class="pl-k">import</span> <span class="pl-s1">jdata</span> <span class="pl-k">as</span> <span class="pl-s1">jd</span> <span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span> <span class="pl-s1">data1</span><span class="pl-c1">=</span><span class="pl-s1">jd</span>.<span class="pl-c1">loadt</span>(<span class="pl-s">'myfile.json'</span>); <span class="pl-s1">data2</span><span class="pl-c1">=</span><span class="pl-s1">jd</span>.<span class="pl-c1">loadb</span>(<span class="pl-s">'myfile.bjd'</span>); <span class="pl-s1">data3</span><span class="pl-c1">=</span><span class="pl-s1">jd</span>.<span class="pl-c1">loadb</span>(<span class="pl-s">'myfile.pmat'</span>);</pre></div> <p>where <code>jd.loadt()</code> function loads a text-based JSON file, performs JData decoding and converts the enclosed data into Python <code>dict</code>, <code>list</code> and <code>numpy</code> objects. Similarly, <code>jd.loadb()</code> function loads a binary JData/UBJSON file and performs similar conversions. One can directly call <code>jd.load()</code> to open JSONLab (and derived toolboxes such as <strong>jnifti</strong>: <a href="https://github.com/NeuroJSON/jnifti">https://github.com/NeuroJSON/jnifti</a> or <strong>jsnirf</strong>: <a href="https://github.com/NeuroJSON/jsnirf">https://github.com/NeuroJSON/jsnirf</a>) generated files based on their respective file suffix.</p> <p>Similarly, the <code>jd.savet()</code>, <code>jd.saveb()</code> and <code>jd.save</code> functions can revert the direction and convert a Python/Numpy object into JData encoded data structure and store as text-, binary- and suffix-determined output files, respectively.</p> <h2>Known Issues and TODOs</h2> <p>JSONLab has several known limitations. We are striving to make it more general and robust. Hopefully in a few future releases, the limitations become less.</p> <p>Here are the known issues:</p> <blockquote> <ul> <li>3D or higher dimensional cell/struct-arrays will be converted to 2D arrays</li> <li>When processing names containing multi-byte characters, Octave and MATLAB can give different field-names; you can use <code>feature('DefaultCharacterSet','latin1')</code> in MATLAB to get consistent<br> results</li> <li><code>savejson</code> can only export the properties from MATLAB classes, but not the methods</li> <li><code>saveubjson</code> converts a logical array into a <code>uint8</code> (<code>[U]</code>) array</li> <li>a special N-D array format, as defined in the JData specification, is implemented in <code>saveubjson</code>. You may use <code>saveubjson(...,'NestArray',1)</code> to create UBJSON Draft-12 compliant files</li> <li><code>loadubjson</code> can not parse all UBJSON Specification (Draft 12) compliant files, however, it can parse all UBJSON files produced by <code>saveubjson</code>.</li> </ul> </blockquote> <h2>Contribution and feedback</h2> <p>JSONLab is an open-source project. This means you can not only use it and modify it as you wish, but also you can contribute your changes back to JSONLab so that everyone else can enjoy the improvement. For anyone who want to contribute, please download JSONLab source code from its source code repositories by using the following command:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="git clone https://github.com/fangq/jsonlab.git jsonlab"><pre>git clone https://github.com/fangq/jsonlab.git jsonlab</pre></div> <p>or browsing the github site at</p> <blockquote> <p><a href="https://github.com/fangq/jsonlab">https://github.com/fangq/jsonlab</a></p> </blockquote> <p>Please report any bugs or issues to the below URL:</p> <blockquote> <p><a href="https://github.com/fangq/jsonlab/issues">https://github.com/fangq/jsonlab/issues</a></p> </blockquote> <p>Sometimes, you may find it is necessary to modify JSONLab to achieve your goals, or attempt to modify JSONLab functions to fix a bug that you have encountered. If you are happy with your changes and willing to share those changes to the upstream author, you are recommended to create a pull-request on github.</p> <p>To create a pull-request, you first need to "fork" jsonlab on Github by clicking on the "fork" button on top-right of JSONLab's github page. Once you forked jsonlab to your own directory, you should then implement the changes in your own fork. After thoroughly testing it and you are confident the modification is complete and effective, you can then click on the "New pull request" button, and on the left, select fangq/jsonlab as the "base". Then type in the description of the changes. You are responsible to format the code updates using the same convention (tab-width: 8, indentation: 4 spaces) as the upstream code.</p> <p>We appreciate any suggestions and feedbacks from you. Please use the following user forum to ask any question you may have regarding JSONLab:</p> <blockquote> <p><a href="https://github.com/orgs/NeuroJSON/discussions/categories/neurojson-json-format-specifications-and-parsers">https://github.com/orgs/NeuroJSON/discussions/categories/neurojson-json-format-specifications-and-parsers</a></p> </blockquote> fangq tag:github.com,2008:Repository/25124906/v2.0 2020-06-16T02:45:02Z JSONLab 2.0 (codename: Magnus Prime) <h1>What's New</h1> <p>Nine years in the making, JSONLab 2.0 (codename: Magnus Prime) has finally arrived!</p> <p>JSONLab 2.0 is not just a MATLAB/Octave toolbox, but a reference library to the below two new data specifications:</p> <ul> <li>JData (language-independent data annotations) Draft 3: <a href="https://github.com/OpenJData/jdata/">https://github.com/OpenJData/jdata/</a></li> <li>Binary JData (a portable interchange format for binary data) Draft 1: <a href="https://github.com/OpenJData/bjdata/">https://github.com/OpenJData/bjdata/</a></li> </ul> <p>Numerous updates have been added in this milestone release since its previous<br> version v1.9.8 in Oct. 2019. A list of the major changes are summarized below<br> (with key features marked by *), including the support to <code>_ArrayShape_</code> to<br> efficiently encode special matrices, the addition of <code>jsave/jload</code> to save<br> and restore variables in MATLAB/Octave like the <code>save/load</code> commands<br> (experimental), and the associated Python modules (<code>jdata</code> and <code>bjdata</code>):</p> <ul> <li>2020-06-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/81feef3b1b33e704e6046362d4ca2f936cb904cf/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/81feef3b1b33e704e6046362d4ca2f936cb904cf"><tt>81feef3</tt></a>] skip no-op markers, update documentation</li> <li>2020-06-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4904155bd3522252241d87e10f799397de26dd8c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4904155bd3522252241d87e10f799397de26dd8c"><tt>4904155</tt></a>] jload load data to struct, test if loadbj input is buffer, update error msg</li> <li>2020-06-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c33479995ec1fc325fe7f48b2bb26820163a7f1b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c33479995ec1fc325fe7f48b2bb26820163a7f1b"><tt>c334799</tt></a>] change default workspace to caller for jload and jsave</li> <li>2020-06-10 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c88354682bdfb4d188ebcf0e432c2edeaccdb7fe/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c88354682bdfb4d188ebcf0e432c2edeaccdb7fe"><tt>c883546</tt></a>] fix keeptype single integer bug</li> <li>2020-06-09*[ ] created <code>jdata</code> and <code>bjdata</code> python modules to share data with MATLAB</li> <li>2020-06-08*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/cbde60700314d7320ff77e2a5aebb375d3b9c767/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/cbde60700314d7320ff77e2a5aebb375d3b9c767"><tt>cbde607</tt></a>] add savebj and loadbj to dedicate to loading and saving bjdata</li> <li>2020-06-08*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e2451e13d74a29fbd88a8cb90ea37a785926da7d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e2451e13d74a29fbd88a8cb90ea37a785926da7d"><tt>e2451e1</tt></a>] add unit testing script, fix issues found in the testing unit</li> <li>2020-06-06 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a44015fae546db37244a6ead2beb81062a23169b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a44015fae546db37244a6ead2beb81062a23169b"><tt>a44015f</tt></a>] accelerate fast_match_bracket, drop unicode2native for speed</li> <li>2020-06-06 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/eefccf3efeb8e3c309b2262f7d683f42fffb3d99/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/eefccf3efeb8e3c309b2262f7d683f42fffb3d99"><tt>eefccf3</tt></a>] call jsonencode/decode in jsave/jload, parse embedded jdata struct</li> <li>2020-06-05 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9434103ada06f6aeda9fd1932ac1ec5e5ffc84f5/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9434103ada06f6aeda9fd1932ac1ec5e5ffc84f5"><tt>9434103</tt></a>] support Toeplitz matrices, use case-insensitive comparison</li> <li>2020-06-04 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3119ce422fd21848cd989c08d572c46cff587907/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3119ce422fd21848cd989c08d572c46cff587907"><tt>3119ce4</tt></a>] jdatadecode now handles <em>ArrayOrder</em></li> <li>2020-06-04 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/89b844cd9cc9c1ea9535d2dcdf03dce0ff8e9e32/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/89b844cd9cc9c1ea9535d2dcdf03dce0ff8e9e32"><tt>89b844c</tt></a>] remove forced root name, update internal test results</li> <li>2020-06-02*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/15ca7ae7e39ff93511b0506ee4823fb60d69b07c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/15ca7ae7e39ff93511b0506ee4823fb60d69b07c"><tt>15ca7ae</tt></a>] add keeptype option to jsave and saveubjson</li> <li>2020-06-02 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/7f2cbc450a77c7ff69413f787f1c5c0314830b12/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/7f2cbc450a77c7ff69413f787f1c5c0314830b12"><tt>7f2cbc4</tt></a>] make jsave and jload work on octave</li> <li>2020-06-01*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8829d6b255a7dc90f286007fa7f0c3f8a44c00a8/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8829d6b255a7dc90f286007fa7f0c3f8a44c00a8"><tt>8829d6b</tt></a>] apply data compression to strings, new datatype char</li> <li>2020-06-01 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/270cbf6c57c92d8a01d5ee7bd3eb6c9896a71f2c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/270cbf6c57c92d8a01d5ee7bd3eb6c9896a71f2c"><tt>270cbf6</tt></a>] fix loadmsgpack ND array issue</li> <li>2020-06-01*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/919f50294bb21b055adfccad91f5581b889fbc28/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/919f50294bb21b055adfccad91f5581b889fbc28"><tt>919f502</tt></a>] add jsave and jload for portable data sharing</li> <li>2020-05-31 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/df3a4faa916b2441c26854d74a0aa81574e16416/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/df3a4faa916b2441c26854d74a0aa81574e16416"><tt>df3a4fa</tt></a>] debug arrayshape related changes and test all demo scripts</li> <li>2020-05-31*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/fc0b2859d9b1fa3984464b6680207b2b4c480272/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/fc0b2859d9b1fa3984464b6680207b2b4c480272"><tt>fc0b285</tt></a>] adding support to <em>ArrayShape</em> to record special matrices</li> <li>2020-05-15*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d88d4542cb0e75f35000560afef1d14bdfbe0146/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d88d4542cb0e75f35000560afef1d14bdfbe0146"><tt>d88d454</tt></a>] jsonlab is compatible with matlab R2008</li> <li>2020-05-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/86efe89e734331d2133092f9a40e40560554d538/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/86efe89e734331d2133092f9a40e40560554d538"><tt>86efe89</tt></a>] flag to prevent embedding ND array size specifier</li> <li>2020-05-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a189a503dfe95ac7daae17b83ab84f3776b37ce3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a189a503dfe95ac7daae17b83ab84f3776b37ce3"><tt>a189a50</tt></a>] use more robust integer type testing</li> <li>2020-05-06*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/82f5249190e43752ba42df047efdce1f3e878c18/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/82f5249190e43752ba42df047efdce1f3e878c18"><tt>82f5249</tt></a>] saveubjson now implments BJData spec Draft1,<a href="https://github.com/fangq/bjdata">https://github.com/fangq/bjdata</a></li> <li>2020-05-03 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/34bca22f3d696760a06952b99c8494e821073dd1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/34bca22f3d696760a06952b99c8494e821073dd1"><tt>34bca22</tt></a>] add prj file to compile a matlab package, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="525169891" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/60" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/60/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/60">#60</a></li> <li>2020-05-03 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/82dfdcc54e231dd5a5a74e5ceb5b31ac5969efc0/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/82dfdcc54e231dd5a5a74e5ceb5b31ac5969efc0"><tt>82dfdcc</tt></a>] handle empty array in loadmsgpack, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="611505139" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/63" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/63/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/63">#63</a>, patch by stfnp</li> <li>2020-03-08 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/7499bd8fae221d3018d31b359a74422237a8b8ec/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/7499bd8fae221d3018d31b359a74422237a8b8ec"><tt>7499bd8</tt></a>] Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="529226775" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/61" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/61/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/61">#61</a> from j2L4e/patch-1</li> <li>2020-02-09*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/6984111374923dfc6644305056d8dbf6442ab5f9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/6984111374923dfc6644305056d8dbf6442ab5f9"><tt>6984111</tt></a>] add UseMap option to avoid key name conversion</li> <li>2019-11-16 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e46221a7c9fecd950a0503b5a6a16dd6228a3615/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e46221a7c9fecd950a0503b5a6a16dd6228a3615"><tt>e46221a</tt></a>] if <em>ArraySize</em> has a single length, treat as a row vector</li> <li>2019-11-01 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f2bfb653be8349dd8acae845b7b4c0218abdb7ab/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f2bfb653be8349dd8acae845b7b4c0218abdb7ab"><tt>f2bfb65</tt></a>] fix a uint8 upper bound bug</li> <li>2019-10-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/cc4491d95bec910f867b9d07a54eb6633671ce26/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/cc4491d95bec910f867b9d07a54eb6633671ce26"><tt>cc4491d</tt></a>] avoid escaping base64 str, avoid double processing preencoded arrayzipdata</li> <li>2019-10-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4dc76ef808020a0cb8ac9ad9ec0d900fd814ee9c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4dc76ef808020a0cb8ac9ad9ec0d900fd814ee9c"><tt>4dc76ef</tt></a>] make example script compatible with matlab R2010</li> <li>2019-10-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ad8be263b71104218343b10d2d2225d030fd966f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ad8be263b71104218343b10d2d2225d030fd966f"><tt>ad8be26</tt></a>] disable underscore escaping in octave,update all tests and outputs</li> <li>2019-10-24 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d4275c6a6635b31e67aa296f51f9b94d27ce9645/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d4275c6a6635b31e67aa296f51f9b94d27ce9645"><tt>d4275c6</tt></a>] reduce jsonopt calls to speed up encoding and decoding</li> <li>2019-10-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/82c9e9164394c0dfe7fa0907ef0c45f5da0b7f9f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/82c9e9164394c0dfe7fa0907ef0c45f5da0b7f9f"><tt>82c9e91</tt></a>] fix invalid jdatadecode example</li> <li>2019-10-23 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/398539d109a2299fce02ba02403e7f67a4cc820f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/398539d109a2299fce02ba02403e7f67a4cc820f"><tt>398539d</tt></a>] reoptimize for speed</li> <li>2019-10-22*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/650b5ece3448de54b2986c8f9f75475e5ab143c5/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/650b5ece3448de54b2986c8f9f75475e5ab143c5"><tt>650b5ec</tt></a>] enable jdataencode in savejson and saveubjson</li> </ul> <p>Please note that JSONLab v2.0 is now compliant with JData Spec Draft 3; in<br> comparison, v1.9.8 is compatible with Draft 2; v1.9 and previous releases are<br> compatible with Draft 1. JSONLab v2.0 can read all data files generated by<br> v1.9.8, but v1.9.8 can not read the new UBJSON markers introduced in v2.0.</p> <p>The newly introduced <code>jsave/jload</code> functions are in the experimental stage.<br> They generate <code>.jamm</code> files which are renamed binary-JData/UBJSON files;<br> they can be 50% smaller than <code>.mat</code> files if using <code>jsave(...,'compression','lzma')</code><br> and can be readily opened among a long list of programming environments<br> such as Python, JavaScript and Go.</p> <p>The <code>saveubjson/loadubjson</code> functions added support to the Binary JData specification (BJData)<br> v1 Draft-1 (<a href="https://github.com/fangq/bjdata">https://github.com/fangq/bjdata</a>) and are now renamed as <code>savebj/loadbj</code><br> (<code>saveubjson/loadubjson</code> are kept for compatibility purposes as aliases to the new<br> functions). The BJData spec is largely compatible with UBJSON spec Draft 12, with the<br> following differences (we are working with the UBJSON maintainer to merge<br> these two specifications):</p> <ul> <li>BJData adds 4 new numeric data types: <code>uint16 [u]</code>, <code>uint32 [m]</code>, <code>uint64 [M]</code> <br> and <code>float16 [h]</code> ('''new in JSONLab v2.0''')</li> <li>BJData supports an optimized ND array container (supported in JSONLab since 2013)</li> <li>BJData does not convert <code>NaN/Inf/-Inf</code> to <code>null</code> (supported in JSONLab since 2013)</li> </ul> <p>To avoid using the new type markers, one should attach <code>'UBJSON',1</code> in the <code>savebj</code><br> command as</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" savebj('',data,'FileName','myfile.bjd','UBJSON',1);"><pre class="notranslate"><code> savebj('',data,'FileName','myfile.bjd','UBJSON',1); </code></pre></div> <p>To read data files generated by JSONLab v1.9 or older versions, you need to attach<br> option <code>'FormatVersion', 1.9</code> in all the <code>loadjson/savejson</code> function calls.</p> <p>To convert an older file (JSON/UBJSON) to the new format, you should run</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" data=loadjson('my_old_data_file.json','FormatVersion',1.9) savejson('',data,'FileName','new_file.json')"><pre class="notranslate"><code> data=loadjson('my_old_data_file.json','FormatVersion',1.9) savejson('',data,'FileName','new_file.json') </code></pre></div> <p>You are strongly encouraged to convert all pre-v1.9.8 generated data files using the new<br> format.</p> <h1>Introduction</h1> <p>JSONLab is a free and open-source JSON/UBJSON/MessagePack encoder and<br> decoder written in the native MATLAB language. It can be used to convert a MATLAB<br> data structure (array, struct, cell, struct array, cell array, and objects) into<br> JSON/UBJSON/MessagePack formatted strings and files, or to parse a<br> JSON/UBJSON/MessagePack file into MATLAB data structure. JSONLab supports both<br> MATLAB and <a href="http://www.gnu.org/software/octave" rel="nofollow">GNU Octave</a> (a free MATLAB clone).</p> <p>JSON (<a href="http://www.json.org/" rel="nofollow">JavaScript Object Notation</a>) is a highly portable, human-readable and <a href="http://en.wikipedia.org/wiki/JSON" rel="nofollow">"fat-free"</a> text format<br> to represent complex and hierarchical data, widely used for data-exchange in applications.<br> UBJSON (<a href="http://ubjson.org/" rel="nofollow">Universal Binary JSON</a>) is a binary JSON format,<br> specifically designed to specifically address the limitations of JSON, permitting<br> efficient storage of binary data with strongly typed data records, resulting in smaller<br> file sizes and fast encoding and decoding. MessagePack is another binary<br> JSON-like data format widely used in data exchange in web/native applications.<br> It is slightly more compact than UBJSON, but is not directly readable compared<br> to UBJSON.</p> <p>We envision that both JSON and its binary counterparts will play important<br> rules not only for light-weight data storage, but also for storage and interchange<br> of scientific data. It has both the flexibility and generality as in other general-purpose<br> file specifications, such as <a href="http://www.hdfgroup.org/HDF5/whatishdf5.html" rel="nofollow">HDF5</a> but has significantly reduced complexity<br> and excellent readability.</p> <p>Towards this goal, we have developed the JData Specification (<a href="https://github.com/fangq/jdata">http://github.com/fangq/jdata</a>)<br> to standardize serializations of complex scientific data structures, such as<br> N-D arrays, sparse/complex-valued arrays, trees, maps, tables and graphs using<br> JSON/binary JSON constructs. The text and binary formatted JData files are<br> syntactically compatible with JSON/UBJSON formats, and can be readily parsed<br> using existing JSON and UBJSON parsers. JSONLab is not just a parser and writer<br> of JSON/UBJSON data files, but one that systematically converts complex scientific<br> data structures into human-readable and universally supported JSON forms using the<br> standardized JData data annotations.</p> <h1>Installation</h1> <p>The installation of JSONLab is no different from installing any other<br> MATLAB toolbox. You only need to download/unzip the JSONLab package<br> to a folder, and add the folder's path to MATLAB/Octave's path list<br> by using the following command:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" addpath('/path/to/jsonlab');"><pre class="notranslate"><code> addpath('/path/to/jsonlab'); </code></pre></div> <p>If you want to add this path permanently, you need to type <code>pathtool</code>,<br> browse to the root folder of JSONLab and add to the list, then click "Save".<br> Then, run <code>rehash</code> in MATLAB, and type "which savejson", if you see an<br> output, that means JSONLab is installed for MATLAB/Octave.</p> <p>If you use MATLAB in a shared environment such as a Linux server, the<br> best way to add path is to type</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" mkdir ~/matlab/ nano ~/matlab/startup.m"><pre class="notranslate"><code> mkdir ~/matlab/ nano ~/matlab/startup.m </code></pre></div> <p>and type <code>addpath('/path/to/jsonlab')</code> in this file, save and exit the editor.<br> MATLAB will execute this file every time it starts. For Octave, the file<br> you need to edit is <code>~/.octaverc</code> , where <code>"~"</code> represents your home directory.</p> <p>To use the data compression features, please download the ZMat toolbox from<br> <a href="https://github.com/fangq/zmat/releases/latest">https://github.com/fangq/zmat/releases/latest</a> and follow the instruction to<br> install ZMat first. The ZMat toolbox is required when compression is used on<br> MATLAB running in the <code>-nojvm</code> mode or GNU Octave, or 'lzma/lzip/lz4/lz4hc'<br> compression methods are specified. ZMat can also compress large arrays that<br> MATLAB's Java-based compression API does not support.</p> <h3>Install JSONLab on Fedora 24 or later</h3> <p>JSONLab has been available as an official Fedora package since 2015. You may<br> install it directly using the below command</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo dnf install octave-jsonlab"><pre class="notranslate"><code> sudo dnf install octave-jsonlab </code></pre></div> <p>To enable data compression/decompression, you need to install <code>octave-zmat</code> using</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo dnf install octave-zmat"><pre class="notranslate"><code> sudo dnf install octave-zmat </code></pre></div> <h3>Install JSONLab on Arch Linux</h3> <p>JSONLab is also available on Arch Linux. You may install it using the below command</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo pikaur -S jsonlab"><pre class="notranslate"><code> sudo pikaur -S jsonlab </code></pre></div> <h1>Using <code>jsave/jload</code> to share workspace</h1> <p>Starting from JSONLab v2.0, we provide a pair of functions, <code>jsave/jload</code> to store<br> and retrieve variables from the current workspace, similar to the <code>save/load</code><br> functions in MATLAB and Octave. The files that <code>jsave/jload</code> reads/writes is by<br> default a binary JData file with a suffix <code>.jamm</code>. The file size is comparable<br> (can be smaller if use <code>lzma</code> compression) to <code>.mat</code> files. This feature<br> is currently experimental.</p> <p>The main benefits of using .jamm file to share matlab variables include</p> <ul> <li>a <code>.jamm</code> file can be 50% smaller than a <code>.mat</code> file when using <br> <code>jsave(..., "compression","lzma")</code>; the only drawback is longer saving time.</li> <li>a <code>.jamm</code> file can be readily read/opened among many programming environments, including <br> Python, JavaScript, Go, Java etc, where <code>.mat</code> file support is not generally available. <br> Parsers of <code>.jamm</code> is largely compatible with UBJSON's parsers available at <br> <a href="http://ubjson.org/?page_id=48" rel="nofollow">http://ubjson.org/?page_id=48</a></li> <li>a <code>.jamm</code> file is quasi-human-readable, one can see the internal data fields <br> even in a command line, for example using <code>strings -n 2 file.jamm | astyle</code>, <br> making the binary data easy to be understood, shared and reused.</li> <li><code>jsave/jload</code> can also use MessagePack and JSON formats as the underlying <br> data storage format, addressing needs from diverse applications. <br> MessagePack parsers are readily available at <a href="https://msgpack.org/" rel="nofollow">https://msgpack.org/</a></li> </ul> <h3>jsave.m</h3> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" jsave % save the current workspace to jamdata.jamm jsave mydata.jamm jsave('mydata.jamm','vars',{'var1','var2'}) jsave('mydata.jamm','compression','lzma') jsave('mydata.json','compression','gzip')"><pre class="notranslate"><code> jsave % save the current workspace to jamdata.jamm jsave mydata.jamm jsave('mydata.jamm','vars',{'var1','var2'}) jsave('mydata.jamm','compression','lzma') jsave('mydata.json','compression','gzip') </code></pre></div> <h3>jload.m</h3> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" jload % load variables from jamdata.jamm to the current workspace jload mydata.jamm % load variables from mydata.jamm vars=jload('mydata.jamm','vars',{'var1','var2'}) % return vars.var1, vars.var2 jload('mydata.jamm','simplifycell',0) jload('mydata.json')"><pre class="notranslate"><code> jload % load variables from jamdata.jamm to the current workspace jload mydata.jamm % load variables from mydata.jamm vars=jload('mydata.jamm','vars',{'var1','var2'}) % return vars.var1, vars.var2 jload('mydata.jamm','simplifycell',0) jload('mydata.json') </code></pre></div> <h1>Sharing JSONLab created data files in Python</h1> <p>Despite the use of portable data annotation defined by the JData Specification,<br> the output JSON files created by JSONLab are 100% JSON compatible (with<br> the exception that long strings may be broken into multiple lines for better<br> readability). Therefore, JSONLab-created JSON files (<code>.json, .jnii, .jnirs</code> etc)<br> can be readily read and written by nearly all existing JSON parsers, including<br> the built-in <code>json</code> module parser in Python.</p> <p>However, we strongly recommend one to use a lightweight <code>jdata</code> module,<br> developed by the same author, to perform the extra JData encoding and decoding<br> and convert JSON data directly to convenient Python/Numpy data structures.<br> The <code>jdata</code> module can also directly read/write UBJSON/Binary JData outputs<br> from JSONLab (<code>.bjd, .ubj, .bnii, .bnirs, .jamm</code> etc). Using binary JData<br> files are exptected to produce much smaller file sizes and faster parsing,<br> while maintainining excellent portability and generality.</p> <p>In short, to conveniently read/write data files created by JSONLab into Python,<br> whether they are JSON based or binary JData/UBJSON based, one just need to download<br> the below two light-weight python modules:</p> <ul> <li><strong>jdata</strong>: PyPi: <a href="https://pypi.org/project/jdata/" rel="nofollow">https://pypi.org/project/jdata/</a> ; Github: <a href="https://github.com/fangq/pyjdata">https://github.com/fangq/pyjdata</a></li> <li><strong>bjdata</strong> PyPi: <a href="https://pypi.org/project/bjdata/" rel="nofollow">https://pypi.org/project/bjdata/</a> ; Github: <a href="https://github.com/fangq/pybj">https://github.com/fangq/pybj</a></li> </ul> <p>To install these modules on Python 2.x, please first check if your system has<br> <code>pip</code> and <code>numpy</code>, if not, please install it by running (using Ubuntu/Debian as example)</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo apt-get install python-pip python3-pip python-numpy python3-numpy"><pre class="notranslate"><code> sudo apt-get install python-pip python3-pip python-numpy python3-numpy </code></pre></div> <p>After the installation is done, one can then install the <code>jdata</code> and <code>bjdata</code> modules by</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" pip install jdata --user pip install bjdata --user"><pre class="notranslate"><code> pip install jdata --user pip install bjdata --user </code></pre></div> <p>To install these modules for Python 3.x, please replace <code>pip</code> by <code>pip3</code>.<br> If one prefers to install these modules globally for all users, simply<br> execute the above commands using <code>sudo</code> and remove the <code>--user</code> flag.</p> <p>The above modules require built-in Python modules <code>json</code> and NumPy (<code>numpy</code>).</p> <p>Once the necessary modules are installed, one can type <code>python</code> (or <code>python3</code>), and run</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" import jdata as jd import numpy as np from collections import OrderedDict data1=jd.loadt('myfile.json',object_pairs_hook=OrderedDict); data2=jd.loadb('myfile.ubj',object_pairs_hook=OrderedDict); data3=jd.loadb('myfile.jamm',object_pairs_hook=OrderedDict);"><pre class="notranslate"><code> import jdata as jd import numpy as np from collections import OrderedDict data1=jd.loadt('myfile.json',object_pairs_hook=OrderedDict); data2=jd.loadb('myfile.ubj',object_pairs_hook=OrderedDict); data3=jd.loadb('myfile.jamm',object_pairs_hook=OrderedDict); </code></pre></div> <p>where <code>jd.loadt()</code> function loads a text-based JSON file, performs<br> JData decoding and converts the enclosed data into Python <code>dict</code>, <code>list</code><br> and <code>numpy</code> objects. Similarly, <code>jd.loadb()</code> function loads a binary<br> JData/UBJSON file and performs similar conversions. One can directly call<br> <code>jd.load()</code> to open JSONLab (and derived toolboxes such as <strong>jnifti</strong>:<br> <a href="https://github.com/fangq/jnifti">https://github.com/fangq/jnifti</a> or <strong>jsnirfy</strong>: <a href="https://github.com/fangq/jsnirfy">https://github.com/fangq/jsnirfy</a>)<br> generated files based on their respective file suffix.</p> <p>Similarly, the <code>jd.savet()</code>, <code>jd.saveb()</code> and <code>jd.save</code> functions<br> can revert the direction and convert a Python/Numpy object into JData encoded<br> data structure and store as text-, binary- and suffix-determined output files,<br> respectively.</p> fangq tag:github.com,2008:Repository/25124906/v1.9.8 2019-11-02T03:19:29Z JSONLab 1.9.8 (codename: Magnus - beta) <h1>What's New</h1> <p>JSONLab v1.9.8 is the beta release of the next milestone - code named "Magnus".</p> <p>Starting from this release, JSONLab supports encoding/decoding MessagePack,<br> a widely-used binary JSON-like data format. Via ZMat v0.9, JSONLab v1.9.8<br> also supports LZMA/LZ4/LZ4HC data compression/decompression. More importantly,<br> JSONLab is now the official reference implementation for JData Specification (Draft 2)<br> as defined in <a href="https://github.com/fangq/jdata">http://github.com/fangq/jdata</a>, the foundation for the OpenJData<br> Project (<a href="http://openjdata.org" rel="nofollow">http://openjdata.org</a>).</p> <p>There have been numerous major updates to this toolbox since the previous<br> release v1.9 in May 2019. A list of the major changes are summarized below<br> with key features marked by *:</p> <ul> <li>2019-10-22*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/650b5ece3448de54b2986c8f9f75475e5ab143c5/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/650b5ece3448de54b2986c8f9f75475e5ab143c5"><tt>650b5ec</tt></a>] enable preencode by default for savejson and saveubjson</li> <li>2019-10-21*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/874945fd1c5776dcf8d55bb77fc337bb4850a57b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/874945fd1c5776dcf8d55bb77fc337bb4850a57b"><tt>874945f</tt></a>] decode graph data, encode non-char-keyed map data</li> <li>2019-10-18 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/11712b7c69dce6b00ccfe5d80fe44033a9d060de/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/11712b7c69dce6b00ccfe5d80fe44033a9d060de"><tt>11712b7</tt></a>] add any2jd, pass opt to name check, add more options</li> <li>2019-10-18*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f97de9b3deeaeeb8d6a35b386bf889ca9e837489/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f97de9b3deeaeeb8d6a35b386bf889ca9e837489"><tt>f97de9b</tt></a>] extract name encoding/decoding to separate function, like in easyh5</li> <li>2019-10-17*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9d0fd4a5a03c2ca7bbd4298e3441808f65916785/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9d0fd4a5a03c2ca7bbd4298e3441808f65916785"><tt>9d0fd4a</tt></a>] rewrite jdataencode</li> <li>2019-10-15 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/23f14d69b20407f7bc552f686308447c41bee9e9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/23f14d69b20407f7bc552f686308447c41bee9e9"><tt>23f14d6</tt></a>] minor updates to make msgpack to work on octave</li> <li>2019-09-16*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/689cb4082ffbf19eff4785cf072a7542ea2a2043/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/689cb4082ffbf19eff4785cf072a7542ea2a2043"><tt>689cb40</tt></a>] support lz4 and lz4hc compression via zmat v0.9</li> <li>2019-07-11*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/06d33aafd6a768f39c543fe8732eaefede9527fd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/06d33aafd6a768f39c543fe8732eaefede9527fd"><tt>06d33aa</tt></a>] update zmat test to support zmat v0.8 mox-the-fox</li> <li>2019-06-24*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/eba407834f55796d1b4e7fbe3d80d52177d80321/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/eba407834f55796d1b4e7fbe3d80d52177d80321"><tt>eba4078</tt></a>] saving table objects with new syntax</li> <li>2019-06-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3eb6d5609fa032af4156f3fb55bc5c2d40e4ba6e/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3eb6d5609fa032af4156f3fb55bc5c2d40e4ba6e"><tt>3eb6d56</tt></a>] change ArrayCompression keywords to ArrayZip to be short</li> <li>2019-06-12*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e5f2ffbe26c9313df0adc29cd3de0aaa570f3541/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e5f2ffbe26c9313df0adc29cd3de0aaa570f3541"><tt>e5f2ffb</tt></a>] complete saveubjson debug mode, add compression example</li> <li>2019-06-11 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ebbcfd21760b9bf7ddeef2ae93997a89de4147ff/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ebbcfd21760b9bf7ddeef2ae93997a89de4147ff"><tt>ebbcfd2</tt></a>] pass formatversion tag to jdatadecode</li> <li>2019-06-10*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/95b2eb03f1d48c792c8dbd5bdd15355afc7947eb/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/95b2eb03f1d48c792c8dbd5bdd15355afc7947eb"><tt>95b2eb0</tt></a>] add jdataencode and jdatadecode</li> <li>2019-06-10*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f86219d05aba4729476d8a8ade5d78b45c83c2e9/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f86219d05aba4729476d8a8ade5d78b45c83c2e9"><tt>f86219d</tt></a>] major update: use row-major for N-D array, incompatible with old JSONLab</li> <li>2019-05-31*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0c467eef174be25d5cb0a9f67515bbe2b55dd045/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0c467eef174be25d5cb0a9f67515bbe2b55dd045"><tt>0c467ee</tt></a>] support lzma and lzip compression decompression via <a href="https://github.com/fangq/zmat">ZMat Toolbox</a></li> <li>2019-05-31 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/599ee4c1ac9f7380196ae3599ed1a47ae21c5c2d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/599ee4c1ac9f7380196ae3599ed1a47ae21c5c2d"><tt>599ee4c</tt></a>] support categorical data</li> <li>2019-05-30*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d47be4563a260a0d69ac2c5bbf325e49e800ba5c/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d47be4563a260a0d69ac2c5bbf325e49e800ba5c"><tt>d47be45</tt></a>] fast bracket matching</li> <li>2019-05-24*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0ec2d01fa1702cdbd818164d6cc4f05953685c23/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0ec2d01fa1702cdbd818164d6cc4f05953685c23"><tt>0ec2d01</tt></a>] rewriting fastarrayparser, 10x faster for Octave, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="87452069" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/4" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/4/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/4">#4</a></li> <li>2019-05-22*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/d8c19b8f071fd0993583ad3dbfb1dc3692871626/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/d8c19b8f071fd0993583ad3dbfb1dc3692871626"><tt>d8c19b8</tt></a>] add support to MessagePack, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="447256349" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/53" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/53/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/53">#53</a>, add NestArray option, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="87464415" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/6" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/6/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/6">#6</a></li> <li>2019-05-19*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c87e7d277bda467a0e2a1fee75c2b15cc0af23af/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c87e7d277bda467a0e2a1fee75c2b15cc0af23af"><tt>c87e7d2</tt></a>] support containers.Map</li> </ul> <p>Please note that JSONLab v1.9.8 is compliant with JData Spec Draft 2, while<br> v1.9 and previous releases are compatible with Draft 1. The main differences are</p> <ul> <li><code>_ArrayCompressionMethod_, _ArrayCompressionSize_</code> and <code>_ArrayCompressedData_</code><br> were replaced by <code>_ArrayZipType_</code>, <code>_ArrayZipSize_</code> and <code>_ArrayZipData_</code>, respectively</li> <li>The serialization of N-D array data stored in <code>_ArrayData_</code> was changed from column-major to<br> row-major</li> </ul> <p>To read data files generated by JSONLab v1.9 or older versions, you need to attach<br> option <code>'FormatVersion', 1.9</code> in all loadjson/savejson function calls.<br> To convert an older file (JSON/UBJSON) to the new format, you should run</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" data=loadjson('my_old_data_file.json','FormatVersion',1.9) savejson('',data,'FileName','new_file.json')"><pre class="notranslate"><code> data=loadjson('my_old_data_file.json','FormatVersion',1.9) savejson('',data,'FileName','new_file.json') </code></pre></div> <p>You are strongly encouraged to convert all previously generated data files using the new<br> format.</p> <h1>Introduction</h1> <p>JSONLab is a free and open-source implementation of a JSON/UBJSON/MessagePack<br> encoder and a decoder in the native MATLAB language. It can be used to convert a<br> MATLAB data structure (array, struct, cell, struct array, cell array, and objects) into<br> JSON/UBJSON/MessagePack formatted strings, or to decode a JSON/UBJSON/MessagePack<br> file into MATLAB data structure. JSONLab supports both MATLAB and <a href="http://www.gnu.org/software/octave/" rel="nofollow">GNU Octave</a><br> (a free MATLAB clone).</p> <p>JSON (JavaScript Object Notation, <a href="http://json.org/" rel="nofollow">http://json.org/</a> ) is a highly portable, human-readable<br> and <a href="http://en.wikipedia.org/wiki/JSON" rel="nofollow">"fat-free"</a> text format to represent complex and hierarchical data. It is as powerful as<br> <a href="http://en.wikipedia.org/wiki/XML" rel="nofollow">XML</a>, but less verbose. JSON format is widely used for data-exchange in applications.</p> <p>UBJSON (Universal Binary JSON, <a href="http://ubjson.org/" rel="nofollow">http://ubjson.org/</a>) is a binary JSON format,<br> specifically optimized for compact file size and better performance while keeping<br> the semantics as simple as the text-based JSON format. Using the UBJSON<br> format allows to wrap complex binary data in a flexible and extensible<br> structure, making it possible to process complex and large dataset without accuracy<br> loss due to text conversions. MessagePack is another binary JSON-like data<br> format widely used in data exchange in web/native applications. It is slightly more<br> compact than UBJSON, but is not directly readable compared to UBJSON.</p> <p>We envision that both JSON and its binary counterparts will play important roles as<br> mainstream data-exchange formats for scientific research. It has both the flexibility<br> and generality as offered by other popular general-purpose file specifications, such<br> as <a href="http://www.hdfgroup.org/HDF5/whatishdf5.html" rel="nofollow">HDF5</a> but with significantly reduced complexity and excellent readability.</p> <p>Towards this goal, we have developed the JData Specification (<a href="https://github.com/fangq/jdata">http://github.com/fangq/jdata</a>)<br> to standardize serializations of complex scientific data structures, such as<br> N-D arrays, sparse/complex-valued arrays, trees, maps, tables and graphs using<br> JSON/binary JSON constructs. The text and binary formatted JData files are<br> syntactically compatible with JSON/UBJSON formats, and can be readily parsed<br> using existing JSON and UBJSON parsers.</p> <p>Please note that data files produced by <code>saveubjson</code> may utilize a special<br> "optimized header" to store N-D (N&gt;=2) arrays, as defined in the JData Specification Draft 2.<br> This feature is not supported by UBJSON Specification Draft 12. To produce<br> UBJSON files that can be parsed by UBJSON-Draft-12 compliant parsers, you must<br> add the option <code>'NestArray',1</code> in the call to <code>saveubjson</code>.</p> <h1>Installation</h1> <p>The installation of JSONLab is no different from installing any other<br> MATLAB toolbox. You only need to download/unzip the JSONLab package<br> to a folder, and add the folder's path to MATLAB/Octave's path list<br> by using the following command:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" addpath('/path/to/jsonlab');"><pre class="notranslate"><code> addpath('/path/to/jsonlab'); </code></pre></div> <p>If you want to add this path permanently, you can type <code>"pathtool"</code>,<br> browse to the JSONLab root folder and add to the list, then click "Save".<br> Then, run "rehash" in MATLAB, and type "which savejson", if you see an<br> output, that means JSONLab is installed for MATLAB/Octave.</p> <p>If you use MATLAB in a shared environment such as a Linux server, the<br> best way to add path is to type</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" mkdir ~/matlab/ nano ~/matlab/startup.m"><pre class="notranslate"><code> mkdir ~/matlab/ nano ~/matlab/startup.m </code></pre></div> <p>and type addpath('/path/to/jsonlab') in this file, save and quit the editor.<br> MATLAB will execute this file every time it starts. For Octave, the file<br> you need to edit is <code>~/.octaverc</code> , where "~" is your home directory.</p> <h2>Install JSONLab on Fedora 24 or later</h2> <p>JSONLab has been available as an official Fedora package since 2015. You may<br> install it directly using the below command</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo dnf install octave-jsonlab"><pre class="notranslate"><code> sudo dnf install octave-jsonlab </code></pre></div> <p>To enable data compression/decompression, you are encouraged to install <code>octave-zmat</code> using</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo dnf install octave-zmat"><pre class="notranslate"><code> sudo dnf install octave-zmat </code></pre></div> <h2>Install JSONLab on Arch Linux</h2> <p>JSONLab is also available on Arch Linux. You may install it using the below command</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" sudo pacman -S jsonlab"><pre class="notranslate"><code> sudo pacman -S jsonlab </code></pre></div> fangq tag:github.com,2008:Repository/25124906/v1.9 2019-05-06T23:12:44Z JSONLab 1.9 (codename: Magnus - alpha) <p>JSONlab ChangeLog (key features marked by *):</p> <p>== JSONlab 1.9 (codename: Magnus - alpha), FangQ &lt;q.fang neu.edu&gt; ==</p> <p>2019-05-06 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/25ad795a7848dcd0316953def96ae13642d0a1a4/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/25ad795a7848dcd0316953def96ae13642d0a1a4"><tt>25ad795</tt></a>] unescape strings in loadjson.m<br> 2019-05-04 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/2e317c957e26408cdc71eb3d7e473c5fb97a702f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/2e317c957e26408cdc71eb3d7e473c5fb97a702f"><tt>2e317c9</tt></a>] explain extra compression fields<br> 2019-05-02 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/1b1be6595377b49089300df2c50dd6d746b7ba82/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/1b1be6595377b49089300df2c50dd6d746b7ba82"><tt>1b1be65</tt></a>] avoid side effect of removing singletarray<br> 2019-05-02*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/8360fd14c97f5525fc6a870e577ff609f3fb9685/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/8360fd14c97f5525fc6a870e577ff609f3fb9685"><tt>8360fd1</tt></a>] support zmat based base64 encoding and decoding<br> 2019-05-01*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c797bb2c1e38836845fecefd0e64680a83e28c72/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c797bb2c1e38836845fecefd0e64680a83e28c72"><tt>c797bb2</tt></a>] integrating zmat, for zlib/gzip data compression<br> 2019-04-29 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/70551fe4448c348fc4f27a86fbe03388fe92c94d/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/70551fe4448c348fc4f27a86fbe03388fe92c94d"><tt>70551fe</tt></a>] remove warnings from matlab<br> 2019-04-28 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/0d61c4bdb1e1b1cc1aa45346fa146ca3924c5ed6/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/0d61c4bdb1e1b1cc1aa45346fa146ca3924c5ed6"><tt>0d61c4b</tt></a>] complete data compression support, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="438111415" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/52" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/52/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/52">#52</a><br> 2019-04-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/804115b8eff553af1529c904a21bf8a9388c8474/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/804115b8eff553af1529c904a21bf8a9388c8474"><tt>804115b</tt></a>] avoid typecast error<br> 2019-04-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c166aa709788dd1724eac252ea6719b049459c03/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c166aa709788dd1724eac252ea6719b049459c03"><tt>c166aa7</tt></a>] change default compressarraysize to 100<br> 2019-04-27*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3322f6f5cca1ffab353dd2403893630b120285fd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3322f6f5cca1ffab353dd2403893630b120285fd"><tt>3322f6f</tt></a>] major new feature: support array compression and decompression<br> 2019-03-13*[<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/9c01046d65620ec1832b59571e4b7c86bce9c828/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/9c01046d65620ec1832b59571e4b7c86bce9c828"><tt>9c01046</tt></a>] support saving function handles, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="409914338" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/51" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/51/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/51">#51</a><br> 2019-03-13 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/a8fde38669bf6e470e80750df9d199f1048232b1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/a8fde38669bf6e470e80750df9d199f1048232b1"><tt>a8fde38</tt></a>] add option to parse string array or convert to char, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="390229506" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/50" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/50/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/50">#50</a><br> 2019-03-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ed2645e558c510b806c738de8b9dc71096a708ae/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ed2645e558c510b806c738de8b9dc71096a708ae"><tt>ed2645e</tt></a>] treat string array as cell array in newer matlab<br> 2018-11-18 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/c3eb0210b4a149034c05d4bbe040015b7846ecdd/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/c3eb0210b4a149034c05d4bbe040015b7846ecdd"><tt>c3eb021</tt></a>] allow saving uint64 integers in saveubjson, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="372311461" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/49" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/49/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/49">#49</a></p> fangq tag:github.com,2008:Repository/25124906/v1.8 2018-07-12T18:08:41Z JSONlab 1.8 (codename: Nominus - final) <p>JSONlab ChangeLog (key features marked by *):</p> <p>== JSONlab 1.8 (codename: Nominus - final), FangQ &lt;q.fang (at) neu.edu&gt; ==</p> <p>2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/03a6c25722edb33f477f13c64c45a28b229517e2/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/03a6c25722edb33f477f13c64c45a28b229517e2"><tt>03a6c25</tt></a>] update documentation, bump version to 1.8, tag Nominus<br> 2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/1597106f3b81ef6c0a40d01921cfd92a21714cce/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/1597106f3b81ef6c0a40d01921cfd92a21714cce"><tt>1597106</tt></a>] add patch provided by pjkoprowski to support MATLAB table, fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="180681167" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/29" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/29/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/29">#29</a><br> 2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/f16cc57d62450fb913bf659bba4adb6e41e50f03/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/f16cc57d62450fb913bf659bba4adb6e41e50f03"><tt>f16cc57</tt></a>] fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="206567634" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/31" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/31/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/31">#31</a>, throw an error when : array construct is used<br> 2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/956e000bec5b92c69afecf55fb66c852057000e3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/956e000bec5b92c69afecf55fb66c852057000e3"><tt>956e000</tt></a>] drop octave 3.x support, fix ubjson error in octave<br> 2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e090f0a519214616525c9ea90b4b60d2babcbc93/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e090f0a519214616525c9ea90b4b60d2babcbc93"><tt>e090f0a</tt></a>] fix octave warning for saveubjson<br> 2018-07-12 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/34284c7601083e1b247aaad2fa5cca9d0f9cb59f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/34284c7601083e1b247aaad2fa5cca9d0f9cb59f"><tt>34284c7</tt></a>] fix issues <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="215629615" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/34" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/34/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/34">#34</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="243255773" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/39" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/39/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/39">#39</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="272629913" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/44" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/44/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/44">#44</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="277045362" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/45" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/45/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/45">#45</a>, support double-quited strings<br> 2017-09-06 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/474d8c824800b5f2109c08f989085cb961acdbe3/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/474d8c824800b5f2109c08f989085cb961acdbe3"><tt>474d8c8</tt></a>] Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="248465588" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/41" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/41/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/41">#41</a> from dasantonym/master<br> 2017-08-07 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/38b24fbfa874ac07122949ad2b1b4b4831d523ed/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/38b24fbfa874ac07122949ad2b1b4b4831d523ed"><tt>38b24fb</tt></a>] added package.json to be able to intall via npm, converted readme to utf-8, added .gitignore<br> 2017-07-19 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/ae7a5d958dc27901dbe37a108b289235add37182/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/ae7a5d958dc27901dbe37a108b289235add37182"><tt>ae7a5d9</tt></a>] Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="243585700" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/40" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/40/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/40">#40</a> from astorfi/master<br> 2017-07-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/3176d44cdecc9fab9ba64269ee6c70a9668fd17f/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/3176d44cdecc9fab9ba64269ee6c70a9668fd17f"><tt>3176d44</tt></a>] Add files via upload<br> 2017-07-17 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/154ef61e3bcb74c98fb4dbe46fc0a375b54d789a/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/154ef61e3bcb74c98fb4dbe46fc0a375b54d789a"><tt>154ef61</tt></a>] Rename README.txt to README.rst<br> 2017-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/31b5bdc283f54733dca6352c760cd363878886e1/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/31b5bdc283f54733dca6352c760cd363878886e1"><tt>31b5bdc</tt></a>] simplify condition flow in matching_bracket<br> 2017-03-27 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/86ef12a57bbe54a8532c0e0015f52c7850519833/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/86ef12a57bbe54a8532c0e0015f52c7850519833"><tt>86ef12a</tt></a>] avoid error in matlab 2017a, close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="215629615" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/34" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/34/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/34">#34</a><br> 2017-02-18 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/4a09ac3c22cf2aa489846d588432815b1019eb4b/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/4a09ac3c22cf2aa489846d588432815b1019eb4b"><tt>4a09ac3</tt></a>] Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="207509035" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/32" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/32/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/32">#32</a> from vrichter/master<br> 2017-02-14 [<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/NeuroJSON/jsonlab/commit/e67d3a3cf330ec0391bfd7e6451c3f4111b27d05/hovercard" href="https://github.com/NeuroJSON/jsonlab/commit/e67d3a3cf330ec0391bfd7e6451c3f4111b27d05"><tt>e67d3a3</tt></a>] respect integer types</p> fangq tag:github.com,2008:Repository/25124906/v1.5 2017-01-03T00:58:57Z JSONlab v1.5 (Nominus alpha) <p>JSONlab ChangeLog (key features marked by *):</p> <p>== JSONlab 1.5 (codename: Nominus - alpha), FangQ &lt;q.fang (at) neu.edu&gt; ==</p> <p>2017/01/02 *use Big-endian format to store floating points (d/D) in saveubjson (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="166736883" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/25" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/25/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/25">#25</a>)<br> 2017/01/02 *speedup parsing large unstructured data by 2x (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="105395758" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/9" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/9/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/9">#9</a>)<br> 2017/01/01 make parsing independent of white space (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="197724266" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/30" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/30/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/30">#30</a>)<br> 2016/08/27 allow to parse array of homogeneous elements (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="87458253" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/5" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/5/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/5">#5</a>)<br> 2016/08/22 permit [] inside file names in savejson<br> 2016/01/06 fix a bug that prevents saving to a file in savejson</p> fangq tag:github.com,2008:Repository/25124906/v1.2 2015-12-30T23:24:45Z JSONLab Optimus Update 2 <p>JSONlab ChangeLog (key features marked by *):</p> <p>== JSONlab 1.2 (codename: Optimus - Update 2), FangQ &lt;q.fang (at) neu.edu&gt; ==</p> <p>2015/12/16 replacing string concatenation by str cells to gain 2x speed in savejson (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="122404902" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/17" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/17/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/17">#17</a>)<br> 2015/12/11 fix FileName option case bug (SVN rev#495)<br> 2015/12/11 add SingletCell option, add SingletArray to replace NoRowBracket (Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="121041184" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/15" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/15/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/15">#15</a>,<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="104679953" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/8" data-hovercard-type="issue" data-hovercard-url="/NeuroJSON/jsonlab/issues/8/hovercard" href="https://github.com/NeuroJSON/jsonlab/issues/8">#8</a>)<br> 2015/11/10 fix bug for inerpreting file names as JSON string - by Mykhailo Bratukha (Pull <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="116090401" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/14" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/14/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/14">#14</a>)<br> 2015/10/16 fix bug for cell with transposed data - by Insik Kim (Pull <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="113298694" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/12" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/12/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/12">#12</a>)<br> 2015/09/25 support exporting matlab object to JSON - by Sertan Senturk (Pull <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="108246522" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/10" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/10/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/10">#10</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="109778695" data-permission-text="Title is private" data-url="https://github.com/NeuroJSON/jsonlab/issues/11" data-hovercard-type="pull_request" data-hovercard-url="/NeuroJSON/jsonlab/pull/11/hovercard" href="https://github.com/NeuroJSON/jsonlab/pull/11">#11</a>)</p> fangq tag:github.com,2008:Repository/25124906/v1.1 2015-12-30T22:58:07Z v1.1 <p>Version 1.1 - Optimus Update 1</p> fangq tag:github.com,2008:Repository/25124906/v1.0 2015-12-30T23:00:15Z v1.0 <p>Version 1.0 - Optimus Final</p> fangq tag:github.com,2008:Repository/25124906/v1.0-RC2 2015-12-30T23:04:00Z v1.0-RC2 <p>Version 1.0-RC2 - Optimus RC2</p> fangq