HiHere are the JSON content from your log file
{ "totalCount": 2, "successCount": 2, "errorCount": 0, "records": [ { "failed": false, "identity": { "documentNo": "NPR45787", "idType": 1, "verified": true, "ifscCode": "", "nameAsPerDoc": "S Raj Kumar", "expiryDate": "2021-01-01", "verifiedDate": "2019-02-01", "employee": 1, "id": 1183 }, "error": null }, { "failed": false, "identity": { "documentNo": "********5413", "idType": 2, "verified": true, "ifscCode": "", "nameAsPerDoc": "D Mohan Rao", "expiryDate": "2022-02-02", "verifiedDate": "2019-02-02", "employee": 5, "id": 1184 }, "error": null } ] }After the entire content was loaded to a dict, e.g ${json_dict}, we can access all attributesFor example, if you don't expect any error count, you can use following:Should Not Be Equal as Integer 0 ${json_dict['errorCount']}
If you want to access particular attributes of a single record, you can simply use this as an example
${emplyees} Set Variable ${json_dict['records'][0]['identity']['employee']}Anyway, ${json_dict} is a regular dict which allows to access it with standard RF method
在 2019年5月16日星期四 UTC+8上午1:19:18,Ananda Kumar写道:Let's say, we have response body stored in ${response} already as string or uni-code, and you can do following${json_dict} Evaluate json.loads(${response}) modules=jsonAfter that, a dict will be stored in ${json_dict}- from here how to validate for particular parameters.you are loading entire response using json.loads(${response})can you explain , if i want evaluate few result from response.regards.Ananda
On Wednesday, May 15, 2019 at 4:03:54 PM UTC+5:30, 诸玉锋 wrote:HiLet's say, we have response body stored in ${response} already as string or uni-code, and you can do following${json_dict} Evaluate json.loads(${response}) modules=jsonAfter that, a dict will be stored in ${json_dict}Regards
在 2019年4月26日星期五 UTC+8下午2:36:15,Nagaraj Hebbar写道:How to verify the JSON result using the Robot Framework RESTinstance library. I have API response body that have attached through the mail how to verify the result of the response body using RESTinstance library can anyone help regarding this.
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/f3bfa85d-3fec-490d-ba42-f3c8361d7a96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.