Json Parsing error on formatted text
古いコメントを表示
Hi,
I have a script that reads formatted text from a Github release description. The text has bullets, some non-ASCII characters, etc. When I look at the string, the special characters are escaped (\r, etc). When I try to write this entire text block to another Github release, it fails with an "error parsing Json" error.
I believe this has to do with either a Conten-type header or UTF encoding, which I'm not fully familiar with.
Is there a straight-forward way in Matlab to read and write formatted text "as-is"?
Thanks.
Joe
8 件のコメント
Walter Roberson
2021 年 3 月 26 日
fread() and fwrite()?
Joe Rustan
2021 年 3 月 26 日
Walter Roberson
2021 年 3 月 27 日
Ah, I see what you mean.
I am not familiar with the encoding requirements for that API.
But as a quick test, could you experiment with https://www.mathworks.com/help/matlab/ref/regexptranslate.html ?
Mohammad Sami
2021 年 3 月 27 日
Assuming you are using webread and webwrite ? If the content type sent by the rest API is application/json, MATLAB webread will automatically process it with jsondecode and return you a struct. Are you getting a struct as the output of webread ?
Joe Rustan
2021 年 3 月 27 日
Walter Roberson
2021 年 3 月 28 日
Could you speak more of exactly how you are doing the curl ?
Joe Rustan
2021 年 3 月 29 日
Walter Roberson
2021 年 3 月 29 日
Can you use git commands instead?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で JSON Format についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!