在Graphql请求中发送双引号和反斜杠

时间:2016-06-08 17:35:51

标签: graphql graphql-js

我想在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中,我想在描述中发送双引号和反斜杠。请指导我克服这一点。

提前致谢。

1 个答案:

答案 0 :(得分:4)

你应该尝试逃避这样的角色

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

希望有所帮助!