10

我想在 Graphql 请求中发送双引号(“)和反斜杠(\),并希望得到它作为响应。

请检查以下示例:

mutation M { 
    signUp
    (
        name: "Harsha Vardhan"
        username: "Harsha143", 
        email: "harshavardhan@sample.com",
        description: "Cool "boy" \n And good looking."
    ) 
    {
        _id,
        name
        username,
        email,
        description
}

在上面的 Mutation 我想在描述中发送双引号和反斜杠。请指导我克服这一点。

提前致谢。

4

1 回答 1

6

你应该试着像这样逃避那些角色

mutation M { 
    signUp
    (
        name: "Harsha Vardhan"
        username: "Harsha143", 
        email: "harshavardhan@sample.com",
        description: "Cool \"boy\" \\n And good looking."
    ) 
    {
        _id,
        name
        username,
        email,
        description
}

希望有帮助!

于 2016-06-12T22:49:12.183 回答