我有 markdown 字符串存储在 json 文件中,所以我使用多行和字符串中的很多东西。如何将其存储在 json 对象中?
\n\n[\n { "title": "Title of Ebook",\n "details": [\n {\n "head": "Introduction 1",\n "data": """It\xe2\x80\x99s important to follow trends in your field to ensure you\xe2\x80\x99re staying current on standards and protocols and perhaps more so in the field of coding. Programmers of all specialties can benefit from following \n#h this is a header\n__italic__\nindustry-leading blogs to stay aware of the latest technologies.If you\xe2\x80\x99re a coder of any sort you\xe2\x80\x99ll want to subscribe to these useful programming blogs written by the top blogging coders.Each of these bloggers has made a name for themselves in the programming community by sharing relevant, high-quality information and tips for coders. They maintain their respective blogs well and keep current information posted on a regular basis.By following the best programming blogs you\xe2\x80\x99ll find tips and shortcuts you may never have otherwise thought to try. Consider using an RSS feed reader through your phone or desktop browser to automatically download each new post from these top coding bloggers."""\n }\n }\n]\nRun Code Online (Sandbox Code Playgroud)\n\n当我收到字符串时,我将从 json 中获得 markdown 样式数据。
\n您的对象未正确关闭。缺少右括号。
\n\n不确定它是否回答了您的问题,但您可以这样做:
\n\nimport \'dart:convert\';\n\nmain(List<String> arguments) {\n var json = [\n {\n "title": "Title of Ebook",\n "details": [\n {\n "head": "Introduction 1",\n "data":\n """It\xe2\x80\x99s important to follow trends in your field to ensure you\xe2\x80\x99re staying current on standards and protocols and perhaps more so in the field of coding. Programmers of all specialties can benefit from following \n#h this is a header\n__italic__\nindustry-leading blogs to stay aware of the latest technologies.If you\xe2\x80\x99re a coder of any sort you\xe2\x80\x99ll want to subscribe to these useful programming blogs written by the top blogging coders.Each of these bloggers has made a name for themselves in the programming community by sharing relevant, high-quality information and tips for coders. They maintain their respective blogs well and keep current information posted on a regular basis.By following the best programming blogs you\xe2\x80\x99ll find tips and shortcuts you may never have otherwise thought to try. Consider using an RSS feed reader through your phone or desktop browser to automatically download each new post from these top coding bloggers."""\n }\n ]\n }\n ];\n\n var encodedJson = jsonEncode(json);\n\n print(encodedJson);\n\n var details = json[0][\'details\'] as List;\n print(details[0][\'data\']);\n}\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4307 次 |
| 最近记录: |