is there any way to append multiple json files into single files
27 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Gayatri
2024-11-6,6:53
Hi Anuj,
You can use below script to append multiple JSON files into single file.
%Read contents of File 1
st1 = fileread('label_data_1.json');
%Read contents of File 2
st2 = fileread('label_data_2.json');
%Open a new JSON file in text mode
[fid,msg] = fopen('combined.json','wt');
%Write contents of File 1 and File 2 in the new file
fprintf(fid,'%s\n%s',st1,st2);
%Close the open file
fclose(fid);
Here "combined.json" will be the desired JSON file.
Please refer the below documentation for fprintf : https://www.mathworks.com/help/matlab/ref/fprintf.html
更多回答(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!