File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email.
47
47
48
48
Arbitrary data encoded in JavaScript Object Notation. See https://www.json.org .
49
49
50
- This expects a string in JSON format, not a GraphQL literal.
50
+ This expects a string in JSON format, not an arbitrary JSON value or GraphQL literal.
51
51
52
52
``` graphql
53
53
type Query {
@@ -65,6 +65,26 @@ type Query {
65
65
}
66
66
```
67
67
68
+ ```json
69
+ // Wrong , the variable value is a JSON object
70
+ {
71
+ "query" : "query ($bar: JSON!) { foo(bar: $bar) }" ,
72
+ "variables" : {
73
+ "bar" : {
74
+ "baz" : 2
75
+ }
76
+ }
77
+ }
78
+
79
+ // Correct , the variable value is a JSON string representing an object
80
+ {
81
+ "query" : "query ($bar: JSON!) { foo(bar: $bar) }" ,
82
+ "variables" : {
83
+ "bar" : "{ \" bar \": 2 }"
84
+ }
85
+ }
86
+ ```
87
+
68
88
JSON responses will contain nested JSON strings.
69
89
70
90
``` json
You can’t perform that action at this time.
0 commit comments