From 95079a43efc38651e61e1a21ddc3714098250ad8 Mon Sep 17 00:00:00 2001 From: Vathsan Date: Thu, 20 Jan 2022 17:12:29 +0530 Subject: [PATCH] Add note on DSS Json template guidelines Fixes https://github.com/wso2/micro-integrator/issues/1522 --- .../data_integration/json-with-data-service.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/en/micro-integrator/docs/use-cases/examples/data_integration/json-with-data-service.md b/en/micro-integrator/docs/use-cases/examples/data_integration/json-with-data-service.md index da59d7de2..4260a125e 100644 --- a/en/micro-integrator/docs/use-cases/examples/data_integration/json-with-data-service.md +++ b/en/micro-integrator/docs/use-cases/examples/data_integration/json-with-data-service.md @@ -163,6 +163,18 @@ Alternatively, you can use one of the following JSON templates for the response } ``` + +!!! Info + As shown in the sample given above, the column name values that are expected in the query result should be referred to by the column name with the `$` prefix. E.g. `$EmployeeNumber`. + + Also, the structure of the JSON template should follow some guidelines in order to be compatible with the result. These guidelines are: + + - The top most item should be a JSON object. It cannot be a JSON array. + - For handling multiple records from the result set, the immediate child of the top most object can be a JSON array, and the array should contain only a single object. + - If only a single result is returned, the immediate child of the top most object can be a single JSON object. + - After the immediate child of the top most object, there cannot be other JSON arrays in the mapping. + + All JSON responses are returned as an array. - If you want to write a nested query using JSON, see the example on [nested queries](../../../../use-cases/examples/data_integration/nested-queries-in-data-service).