Structure to JSON

version (3.42 KB) by Lior Kirsch
Saves a structure in JSON format


Updated Sat, 23 May 2015 22:16:32 +0000

View License

Saves the values in the structure 'data' to a file using JSON format.
Example: = 'chair';
data.color = 'pink';
data.metrics.height = 0.3;
data.metrics.width = 1.3;
saveJSONfile(data, 'out.json');

Output 'out.json':
"name" : "chair",
"color" : "pink",
"metrics" : {
"height" : 0.3,
"width" : 1.3

Cite As

Lior Kirsch (2022). Structure to JSON (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired: Structure and object to JSON

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!