JSON objects are imported or exported using MATLAB with the help of Python. All that is required, aside from an installation of Python, is to specify the location of the JSON file.
Why another JSON parser? I wanted a minimalist function that would import/export a JSON file in the most straightforward manner possible. I believed that function did not exist as of Oct. 2015. I've also become enamored with using Python to handle tasks common to Python, but not directly supported in MATLAB. This is what makes the code minimal. Python does the heavy lifting and a recursive function finishes the conversion.
There was a bug in the JSON export regarding arrays in a cell.
Conceptually I thought it would be an improvement to separate the process of converting from MATLAB to Python and vice versa into their own functions.
I forgot to actually change the files in the last update. Whoops!
Added the ability to export MATLAB data to a JSON file.
Inspired by: JSON Parser, JSONlab: a toolbox to encode/decode JSON files, Core_twitter: A wrapper for the Python package Tweepy to interface with the Twitter API, Core_py2matlab: convert data from Python to MATLAB and back.
Win cash prizes and have your live script featured on our websiteLearn more
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.