Collecting multiple .json objects in one .json file?
12 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone, I'm developing a deep learning Mask R-CNN training.
I have labeled images through imageLabeler and I got the annotations as gTruth file. Then I have converted these files in .json objects using the following code :
annotationsFileName='gTruth_coco.json';
exportGroundTruthToJSON(gTruth,annotationsFileName,'COCO',true)
Now, the problem is I have to collect these .json files in one .json file.
How can I do that?
Many thanks for your attention and your kind help.
0 件のコメント
回答 (1 件)
Prince Kumar
2021 年 11 月 17 日
編集済み: Prince Kumar
2021 年 11 月 19 日
You can open the json files and append them one after another. Following is how you can achieve it.
st1 = fileread('data/label_data_1.json');
st2 = fileread('data/label_data_2.json');
[fid,msg] = fopen('combined.json','wt');
fprintf(fid,'%s\n%s',st1,st2);
fclose(fid);
Here 'combined.json' will be your desired json file.
To perform the above operation on Linux system without MATLAB, you may run the following commands in terminal
touch combined.json
cat data/label_data_1.json >> combined.json
cat data/label_data_2.json >> combined.json
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で JSON Format についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!