给出这个杰森
{
"myclass": {
"studentname": "myname",
"description": "Student has three more credits to complete\n
he is taking maths\ n
biology this semester "
}
}
我在jsonlint中得到了'description'的Json解析器异常。更改描述以接受数组不是我的选择。
在Json中可以定义多行吗?
答案 0 :(得分:1)
\n
是唯一的方法。 JSON不是编程语言,您不能告诉它连接字符串。这也取决于上下文。
{
"myclass": {
"studentname": "myname",
"description": "Student has three more credits to complete\nhe is taking maths\nbiology this semester"
}
}
{
"myclass": {
"studentname": "myname",
"description": "Student has three more credits to complete\n
he is taking maths\n
biology this semester"
}
}