From 5845416c51b2cdb6f18e1c07bd0ee2069c2c35e8 Mon Sep 17 00:00:00 2001 From: Nicolas Quiniou-Briand Date: Tue, 14 Jul 2020 11:42:29 +0200 Subject: [PATCH] doc: add a note on JSON arrays (#264) * add a note on JSON arrays * add note on special chars for JSON keys --- executors/http/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/executors/http/README.md b/executors/http/README.md index 23fba7ac..e9847248 100644 --- a/executors/http/README.md +++ b/executors/http/README.md @@ -89,10 +89,25 @@ result.error - result.executor.executor.multipartform: multipartform if exists - result.err: if exists, this field contains error - result.body: body of HTTP response -- result.bodyjson: body of HTTP response if it's a json. You can access json data as result.bodyjson.yourkey for example. Note that json keys are lowercased automatically (eg. use result.bodyjson.yourkey, not result.bodyjson.YourKey) +- result.bodyjson: body of HTTP response if it's a JSON. You can access json data as result.bodyjson.yourkey for example. - result.headers: headers of HTTP response - result.statuscode: Status Code of HTTP response +### JSON keys + +JSON keys are lowercased automatically (eg. use `result.bodyjson.yourkey`, not +`result.bodyjson.YourKey`). + +On top of that, if a JSON key contains special characters, they will be translate to underscores. + +### JSON arrays + +When a HTTP response contains a JSON array, you have to use following syntax +to access specific key of an array: `result.bodyjson.array_name.array_name_index_in_array.key` + +Example if you want to get value of `path` key of *second* element in `apis` array: `result.bodyjson.apis.apis1.path` + + ## Default assertion ```yaml