RK3
2 years agoOccasional Contributor
how to read and validate json file using testcomplete
I have a JSON file want to read and validate that file can you one show me with simple code?
- 2 years ago
Use JSON, here's an example,
function Test1() { let text = '{ "employees" : [' + '{ "firstName":"John" , "lastName":"Doe" },' + '{ "firstName":"Anna" , "lastName":"Smith" },' + '{ "firstName":"Peter" , "lastName":"Jones" } ]}'; var obj = JSON.parse(text); for (var i = 0; i < obj.employees.length; i++) { Log.Message(obj.employees[i].firstName); } }
- 2 years ago
You can use aqFile.Compare Method to compare both JSON files