Structure and object to JSON

버전 1.0.4 (1.92 KB) 작성자: Arthur LIU
Save struct and object variables as a JSON file
다운로드 수: 240
업데이트 날짜: 2020/6/26

라이선스 보기

saves the values in the structure 'data' to a file in JSON format.
Based on the work of Lior Kirsch at: https://uk.mathworks.com/matlabcentral/fileexchange/50965-structure-to-json

Modification by Arthur Y.C. Liu 24/06/2020

Example:
data.name = 'chair';
data.color = 'pink';
data.metrics.imageSize = [1920; 1080];
data.metrics.height = 0.3;
data.metrics.width = 1.3;
saveJSONfile(data, 'out.json');

Output 'out.json':
{
"name" : "chair",
"color" : "pink",
"eye" :
[
1,
0,
0,
0,
1,
0,
0,
0,
1
],
"metrics" :
{
"imageSize" :
[
1920,
1080
],
"height" : 0.3,
"width" : 1.3
}
}

인용 양식

Arthur LIU (2024). Structure and object to JSON (https://www.mathworks.com/matlabcentral/fileexchange/77284-structure-and-object-to-json), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
도움

받음: Structure to JSON

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.4

Correct previous file version.

1.0.3

Better documentation

1.0.2

Better format alignment

1.0.1

Added a feature to also output matrix as row-major arrays.

1.0.0