I have Json arrays from 2 different APIs
For Example
1 https://test1.com/api
2 https://test2.com/api
Now below is array response that i have for both the APIs
1.
“resposne1”:[
{
“name”: “Speed1”,
“number”: “1017”,
“status”: “Active”
},
{
“name”: “Speed2”,
“number”: “1018”,
“status”: “Inactive”
}
]
2
“resposne2”:[
{
“t_name”:“Complete”,
t1:
{
“No”: “1017”,
“Test”: “Check”
},
“Flag”:“Active”
},
{
“t_name”:“Speed1”,
t1:
{
“No”: “1018”,
“Test”: “Check”
},
“Flag”:“Inactive”
}
]
Below is the mapper file that i am using
{
“name”: “t_name”,
“number”: “No”,
“status”: “Flag”
}
I need to compare the fields as mentioned in the mapper file for each array element in the json response and to compare both the responses i am savind the json response in a dictionary using Evaluate json.loads keyword but somehow it is giving an error while converting it to dictionary like below:
${json1_dict} = Evaluate json.loads(‘’‘${json1}’‘’, strict=False) json
so not able to move further and compare fields
There are 2 things for which i require a help.
1 How to use Evaluate json.loads to save json response in a dictionary , currently it is giving an error like [FAIL] Evaluating expression 'json.loads
2 How to use the sub element within json response like in the 2nd json response array field For Example, resposne2. t1.No to compare using the mapper file.
Thanks,
Rahul