jSondecode()和jsonencode()的麻烦
43次观看(最近30天)
显示较旧的评论
我有一个JSON文件。我正在尝试在使用MATLAB功能之前测试它们。所以我加了它
str1 = fileread('json_filename1.json');
mydata1 = jsondecode(str1)
str2 = jsonencode(mydata1)
fid = fopen('json_filename2.json','wt')
fprintf(fid,str2)
FCLOSE(FID)
Then I go to the online JSON file editor:
https://jsoneditoronline.org/#left=local.jagoxe
加载两个文件。我能够加载'json_filename1.json',但我无法正确加载'json_filename2.json'。我收到以下错误消息:
Failed to switch to "tree
“由于无效的JSON模式:
第1行的解析错误:
...,“ errordescription”:“ createAcpath执行
-----------------------^
期待“字符串”,“数字”,“ null”,“ true”,“ false”,“ {','[',got'dot'defined'
看起来像JSondecode()或JSONENCODE()有问题。
另外,当我使用strCMP(str1,str2)时,我看到了它们之间的很大差异。