JSON中的多行元素?

I would like to use JSON for sending multiple variables like status, error-message and content to a Javascript function via Ajax.

The problem I'm having is that I fetch the content from a database and almost all data that is sent back to the browser is multi-line. And because of that it seems like my JSON is not validated.

An example of outout might be:

{
    "status" : "ok",
    "message" : "All is well",
    "contents" : "Lorem Ipsum

    Dolor sit amet"
}

Is there any special way of handling multi-line that I've missed or is it plain impossible (seems unlikely)?

Thanks!

查看全部
weixin_33749242
weixin_33749242
2010/01/09 14:54
  • json
  • ajax
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信

1个回复