我试图发送一些Markdown文本到休息api。刚才我发现在json中不接受断行。如何发送MarkDown到API
例子。如何将这个发到我的API:
An h1 header
============
Paragraphs are separated by a blank line.
2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists
look like:
* this one
* that one
* the other one
Note that --- not considering the asterisk --- the actual text
content starts at 4-columns in.
> Block quotes are
> written like so.
>
> They can span multiple paragraphs,
> if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
Unicode is supported. ☺
为
{
"body" : " (the markdown) ",
}
在将其添加到JSON对象之前,您需要“转义”您的Markdown文本。由于您没有告诉我们您正在使用哪种语言/框架,因此以下是“ [escape json](http://stackoverflow.com/search?q=escape+json)“。 – Waylan
将Markdown放入字符串或类似字符串的对象中。将该字符串放入适当的数据结构中。使用你的语言的数据到JSON函数。 (提示:** _从来没有_ **手动构建JSON。) – Chris
谢谢你们,这是一个普遍的问题,但我明白了。谢谢 – 62009030