--- title: "Dynamic JSON / XML Payloads" slug: "dynamic-json-xml-payloads" updated: 2023-08-02T18:07:26Z published: 2023-08-02T18:07:26Z canonical: "knowledge.curiositysoftware.ie/dynamic-json-xml-payloads" --- > ## Documentation Index > Fetch the complete documentation index at: https://knowledge.curiositysoftware.ie/llms.txt > Use this file to discover all available pages before exploring further. # Dynamic JSON / XML Payloads Welcome to our dynamic JSON feature documentation. We provide a way to create dynamic JSON using templating. In this guide, we'll discuss how you can use this feature to craft your test cases in a more flexible and dynamic manner. ### Available Functions We have several functions registered for use in your templates. These helpers provide powerful functionality for conditionally formatting your JSON data. Here is the list of available helpers: - **ifEq:** This helper checks if two arguments are equal and executes the template if true. - **ifGreaterThan:** This helper checks if the first argument is greater than the second argument. - **ifLessThan:** This helper checks if the first argument is less than the second argument. - **ifNotEqualTo:** This helper checks if two arguments are not equal. - **ifGreaterThanOrEqualTo:** This helper checks if the first argument is greater than or equal to the second argument. - **ifLessThanOrEqualTo:** This helper checks if the first argument is less than or equal to the second argument. - **range:** This helper will iterate over a range of integers from the first argument to the second argument. ### How to use the Functions Here is a brief guide on how to use these helpers in your JSON templates: #### Equals This helper checks if two arguments are equal and executes the template if true. ```json { "tags": [ { {{#ifEq "[Value1]" "[Value2]"}} "result": "Values are equal" {{else}} "result": "Values are not equal" {{/ifEq}} } ] } ``` #### Greater Than This helper checks if the first argument is greater than the second argument: ```json { "tags": [ { {{#ifGreaterThan "[Value1]" "[Value2]"}} "result": "Value1 is greater than Value2" {{else}} "result": "Value1 is not greater than Value2" {{/ifGreaterThan}} } ] } ``` #### Less Than This helper checks if the first argument is less than the second argument: ```json { "tags": [ { {{#ifLessThan "[Value1]" "[Value2]"}} "result": "Value1 is less than Value2" {{else}} "result": "Value1 is not less than Value2" {{/ifLessThan}} } ] } ``` #### Not Equal To This helper checks if two arguments are not equal: ```json { "tags": [ { {{#ifNotEqualTo "[Value1]" "[Value2]"}} "result": "Value1 is not equal to Value2" {{else}} "result": "Value1 is equal to Value2" {{/ifNotEqualTo}} } ] } ``` #### Greater Than or Equal To This helper checks if the first argument is greater than or equal to the second argument: ```json { "tags": [ { {{#ifGreaterThanOrEqualTo "[Value1]" "[Value2]"}} "result": "Value1 is greater than or equal to Value2" {{else}} "result": "Value1 is less than Value2" {{/ifGreaterThanOrEqualTo}} } ] } ``` #### Less Than or Equal To This helper checks if the first argument is less than or equal to the second argument: ```json { "tags": [ { {{#ifLessThanOrEqualTo "[Value1]" "[Value2]"}} "result": "Value1 is less than or equal to Value2" {{else}} "result": "Value1 is greater than Value2" {{/ifLessThanOrEqualTo}} } ] } ``` #### Range This helper will iterate over a range of integers from the first argument to the second argument: ```json { "numbers": [ {{#range 1 5}} { "number": {{this}} }, {{/range}} ] } ``` Please note: For the examples above, replace '[Value1]' and '[Value2]' with the actual values you want to compare. If these are variables within your context, ensure they are referenced correctly.