I would if it's possible to test if an object exist on response json
Code: Select all
{
"tickets": [],
"links": [],
"disruptions": [],
"notes": [],
"feed_publishers": [],
"context": {
"timezone": "Europe/Paris",
"current_datetime": "20180402T213237"
},
"error": {
"message": "no solution found for this journey",
"id": "no_solution"
},
"exceptions": []
}
when data exist, the field error don't exist
i have test
Code: Select all
jsonLocation.error.id == "no_solution"
Code: Select all
[string "commandArray = {} ..."]:43: attempt to index field 'error' (a nil value)