# Data driven testing using objects in graphQL queries/mutations

**URL:** <https://community.postman.com/t/data-driven-testing-using-objects-in-graphql-queries-mutations/24614>\
**Category:** Help Hub\
**Tags:** variables, graphql, jsondatafile\
**Created:** [June 7, 2021, 8:06pm UTC](https://community.postman.com/t/data-driven-testing-using-objects-in-graphql-queries-mutations/24614 "2021-06-07T20:06:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![technical-meteorolog](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@technical-meteorolog](https://community.postman.com/u/technical-meteorolog)\
**Post date:** [June 7, 2021, 8:06pm UTC](https://community.postman.com/t/data-driven-testing-using-objects-in-graphql-queries-mutations/24614/1 "2021-06-07T20:06:49Z")

</div>

_How can I use data driven testing in graphQL using variables and objects?_:  
Hey all,

I’m trying to implement data driven testing in my project. We’re using graphql and some of the queries/mutations has very large and tricky variables, there are not only key:values,. there are also objects that contains one or more parameters. I can run the tests without any issue if I only set the parameters outside of the objects, but when I try to use the ones inside of the objects I got a 400 error

_Data_:

Variables in graphql query in postman UI  
{  
“object1”: {  
“parameter1”: {{parameter1}},  
“parameter2”: {{parameter2}}  
},  
“object2”: {  
“parameter3”: {{parameter3}}  
},  
“parameter4”: {{parameter4}},  
“parameter5”: {{parameter5}},  
“object3”: {  
“parameter6”: {{parameter6}},  
“parameter7”: {{parameter7}}  
}  
}

Json file

[

```
	{
		"parameter1": "value1",
		"parameter2": "value2",		
		"parameter3": "value3",
		"parameter4": "value4",
		"parameter5": value5(int),
		"parameter6": value6(boolean),
		"parameter7": value7(int)
	}

```

]  
_How I found the problem_:

When I ran the graphql query using the json file I checked the console and I check the error in the response body

{“message”:“Unexpected token D in JSON at position 2336”,“error”:{“expose”:true,“statusCode”:400,“status”:400,“body”:"{“query”:“query testSomething(variables declaration) {\n other parameters…) “,“variables”:{\n\t\t"object1”: {\n\t\t\t"parameter1”: value1,\n\t\t\t"parameter2": value2\n\t\t},\n\t\t"object2": {\n\t\t\t"parameter3": value3\n\t\t},\n\t\t"parameter4": value4,\n\t\t"parameter5": value5,\n\t\t"object3": {\n\t\t\t"parameter6": value6,\n\t\t\t"parameter7": value7\n\t\t}\n}}",“type”:“entity.parse.failed”}}

_I’ve already tried_:

I changed the json file, adding the objects and I got the same error. Also I tried using csv file. Same error.
