Home > Software design >  How to write a graphql query with json so that the parameter is specified?
How to write a graphql query with json so that the parameter is specified?

Time:10-02

Doesn't work:

{
    "query": "mutation{addTodo(title: "hello"){title}}"
}

Works but the title is "":

{
    "query": "mutation{addTodo{title}}"
}

In graphql syntax (worked but I need to use json):

mutation{
    addTodo(title:"homework"){
        title
    }
}

CodePudding user response:

{
    "query": "mutation{addTodo(title: \"hello\"){title}}"
}
  • Related