{"id":282,"date":"2021-02-18T09:19:48","date_gmt":"2021-02-18T09:19:48","guid":{"rendered":"http:\/\/167.71.55.215\/?page_id=282"},"modified":"2022-11-27T15:19:06","modified_gmt":"2022-11-27T15:19:06","slug":"jmespath-functions","status":"publish","type":"page","link":"https:\/\/info.documotor.com\/?page_id=282","title":{"rendered":"JMESPath Functions"},"content":{"rendered":"\n<p>Our implementation of JMESPath supports all of the following functions defined in the official specification:<\/p>\n\n\n\n<ul><li>abs<\/li><li>avg<\/li><li>ceil<\/li><li>contains<\/li><li>ends_with<\/li><li>floor<\/li><li>join<\/li><li>keys<\/li><li>length<\/li><li>map<\/li><li>max<\/li><li>max_by<\/li><li>min<\/li><li>min_by<\/li><li>not_null<\/li><li>reverse<\/li><li>sort<\/li><li>sort_by<\/li><li>starts_with<\/li><li>sum<\/li><li>to_array<\/li><li>to_string<\/li><li>type<\/li><li>values<\/li><\/ul>\n\n\n\n<p>For further detail, see the official <a href=\"https:\/\/jmespath.org\/specification.html\" data-type=\"URL\" data-id=\"https:\/\/jmespath.org\/specification.html\">JMESPath specification<\/a>. <\/p>\n\n\n\n<p>The function to_number is also supported, but have had extra arguments added and will be documented below.<\/p>\n\n\n\n<div class=\"wp-container-2 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-container-1 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"add\">add<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number add(number $left, number $right)<\/code><\/pre>\n\n\n\n<p>Adds $left and $right together. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>add(`3`, `4`)<\/code><\/td><td><code>7<\/code><\/td><\/tr><tr><td><code>add(`3.0`, `4`)<\/code><\/td><td><code>7<\/code><\/td><\/tr><tr><td><code>add(`3.5`, `4`)<\/code><\/td><td><code>7.5<\/code><\/td><\/tr><tr><td><code>add(`-3.5`, `4`)<\/code><\/td><td><code>0.5<\/code><\/td><\/tr><tr><td><code>add('3', `4`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><tr><td><code>add([`0`, `1`], `2`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-3 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"append\">append<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array append(array $input, any $items)<\/code><\/pre>\n\n\n\n<p>Appends $items to the end of the $input array.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>append([`1`, `2`, `3`], `4`)<\/code><\/td><td><code>[1, 2, 3, 4]<\/code><\/td><\/tr><tr><td><code>append([`1`, `2`], `3`, `4`)<\/code><\/td><td><code>[1, 2, 3, 4]<\/code><\/td><\/tr><tr><td><code>append([`1`, `2`], ['c', 'd'])<\/code><\/td><td><code>[1, 2, \"c\", \"d\"]<\/code><\/td><\/tr><tr><td><code>append([`1`, `2`, `3`], `null`)<\/code><\/td><td><code>[1, 2, 3, null]<\/code><\/td><\/tr><tr><td><code>append('str', `4`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<h2 id=\"calculate\">calculate<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number calculate(string $expression, object $variables)<\/code><\/pre>\n\n\n\n<p>Executes a given mathematical formula using the provided variables.<\/p>\n\n\n\n<p><strong>Note<\/strong>: A variable can only be of type: number.<\/p>\n\n\n\n<h3>Operators<\/h3>\n\n\n\n<ul><li>Addition:  +<\/li><li>Subtraction:  &#8211;<\/li><li>Multiplication:  *<\/li><li>Division:  \/<\/li><li>Modulo:  %<\/li><li>Exponentiation:  ^<\/li><li>Negation:  !<\/li><\/ul>\n\n\n\n<h3>Base functions<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Arguments<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>sin<\/td><td>sin(a1)<\/td><td>Sine<\/td><\/tr><tr><td>cos<\/td><td>cos(a1)<\/td><td>Cosine<\/td><\/tr><tr><td>asin<\/td><td>asin(a1)<\/td><td>Arcsine<\/td><\/tr><tr><td>acos<\/td><td>acos(a1)<\/td><td>Arccosine<\/td><\/tr><tr><td>tan<\/td><td>tan(a1)<\/td><td>Tangent<\/td><\/tr><tr><td>cot<\/td><td>cot(a1)<\/td><td>Cotangent<\/td><\/tr><tr><td>atan<\/td><td>atan(a1)<\/td><td>Arctangent<\/td><\/tr><tr><td>acot<\/td><td>acot(a1)<\/td><td>Arccotangent<\/td><\/tr><tr><td>loge<\/td><td>loge(a1)<\/td><td>Natural logarithm<\/td><\/tr><tr><td>log10<\/td><td>log10(a1)<\/td><td>Logarithm with base 10<\/td><\/tr><tr><td>logn<\/td><td>logn(a1, a2)<\/td><td>Logarithm<\/td><\/tr><tr><td>sqrt<\/td><td>sqrt(a1)<\/td><td>Square root<\/td><\/tr><tr><td>if<\/td><td>if(a1, a2, a3)<\/td><td>IF a1 IS true THEN a2 ELSE a3<\/td><\/tr><tr><td>max<\/td><td>max(a1, &#8230;, a_n)<\/td><td>Maximum<\/td><\/tr><tr><td>min<\/td><td>min(a1, &#8230;, a_n)<\/td><td>Minimum<\/td><\/tr><tr><td>avg<\/td><td>avg(a1, &#8230;, a_n)<\/td><td>Average<\/td><\/tr><tr><td>median<\/td><td>median(a1, &#8230;, a_n)<\/td><td>Median<\/td><\/tr><tr><td>round<\/td><td>round(a1)<\/td><td>Round<\/td><\/tr><tr><td>random<\/td><td>random()<\/td><td>Generate a random double value<br>between 0.0 and 1.0<\/td><\/tr><\/tbody><\/table><figcaption>Base functions<\/figcaption><\/figure>\n\n\n\n<h3>Examples<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td>\n\t\t\t\t\t<code>calculate('a+b', {\"a\": 10, \"b\": 20})<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>30.0<\/code>\n\t\t\t\t<\/td><\/tr><tr><td> <code>calculate('a+b', {\"a\": '10', \"b\": '20'})<\/code> <\/td><td> <code>30.0<\/code> <\/td><\/tr><tr><td>\n\t\t\t\t\t<code>calculate('a+b', {\"a\": 10.5, \"b\": 20})<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>30.5<\/code>\n\t\t\t\t<\/td><\/tr><tr><td> <code>calculate('a-b', {\"a\": 10, \"b\": 20})<\/code> <\/td><td>\n\t\t\t\t\t<code>-10.0<\/code>\n\t\t\t\t<\/td><\/tr><tr><td>\n\t\t\t\t\t<code>calculate('(a+b)*10', {\"a\": 10, \"b\": 20})<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>300.0<\/code>\n\t\t\t\t<\/td><\/tr><tr><td><code>calculate('sin(a)*3', {\"a\": 45})<\/code><\/td><td> <code>2.552..<\/code> <\/td><\/tr><tr><td> <code>calculate('(10+20)\/10', null)<\/code> <\/td><td> <code>3.0<\/code> <\/td><\/tr><tr><td>\n\t\t\t\t\t<code>calculate('a+b', null)<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>Error<\/code>\n\t\t\t\t<\/td><\/tr><tr><td>\n\t\t\t\t\t<code>calculate('a+b', {})<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>Error<\/code>\n\t\t\t\t<\/td><\/tr><tr><td>\n\t\t\t\t\t<code>calculate('10+b', {\"b\": 'aSimpleString'})<\/code>\n\t\t\t\t<\/td><td>\n\t\t\t\t\t<code>Error<\/code>\n\t\t\t\t<\/td><\/tr><\/tbody><\/table><figcaption>Examples<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-container-4 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"currenttime\">current_time<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">datetime current_time(number|string $offset)<\/code><\/pre>\n\n\n\n<p>Gets the current time in UTC as a datetime object and adds $offset hours to it. There is no limit for $offset, so it possible to add 30 days. The $offset argument can be a double, but will be converted to an integer. If $offset is a string, it must have an integer format.<\/p>\n\n\n\n<p>For the examples of this function, we assume that the current time is <code>2021-02-19T12:00:00Z<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>current_time(`0`)<\/code><\/td><td><code>2021-02-19T12:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time('0')<\/code><\/td><td><code>2021-02-19T12:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time(`1`)<\/code><\/td><td><code>2021-02-19T13:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time(`-1`)<\/code><\/td><td><code>2021-02-19T11:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time(`24`)<\/code><\/td><td><code>2021-02-20T12:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time(`0.5`)<\/code><\/td><td><code>2021-02-19T12:00:00Z<\/code><\/td><\/tr><tr><td><code>current_time('0.5')<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-5 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"datasource\">datasource<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object datasource(string $dataSource, string $column, string $value)<\/code><\/pre>\n\n\n\n<p>Fetches data from the specified $dataSource, filtering by $value lookup in $column.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-8 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-container-7 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"distinct\">distinct<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array distinct(array $input)<\/code><\/pre>\n\n\n\n<p>Removes duplicated items from the $input array based on token equality.<\/p>\n\n\n\n<div class=\"wp-container-6 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"input\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Bob\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Ann\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Joe\", \"id\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Joe\", \"id\": 1 }\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Bob\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Ann\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Joe\", \"id\": 1 }\n]<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-11 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-container-10 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"distinct_by\">distinct_by<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array distinct(array $input, &amp;key_function)<\/code><\/pre>\n\n\n\n<p>Removes duplicated items from the $input array based on the key defined by $key_function.<\/p>\n\n\n\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"inputA\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Bob\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Ann\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Joe\", \"id\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Xavier\", \"id\": 1 }\n&nbsp; &nbsp; ],\n&nbsp; &nbsp; \"inputB\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Bob\" },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Ann\", \"id\": 0 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Joe\" },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"Xavier\", \"id\": 1 }\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-container-9 wp-block-group\"><div class=\"wp-block-group__inner-container\"><\/div><\/div>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>distinct_by(inputA, &amp;id)<\/code><\/td><td><code>[{ \"name\": \"Bob\", \"id\": 0 }, { \"name\": \"Joe\", \"id\": 1 }]<\/code><\/td><\/tr><tr><td><code>distinct_by(inputB, &amp;id)<\/code><\/td><td><code>[{ \"name\": \"Ann\", \"id\": 0 }, { \"name\": \"Xavier\", \"id\": 1 }]<\/code><\/td><\/tr><tr><td><code>distinct_by(`[]`, &amp;id)<\/code><\/td><td><code>[]<\/code><\/td><\/tr><tr><td><code>distinct_by(`null`, &amp;id)<\/code><\/td><td><code>null<\/code><\/td><\/tr><tr><td><code>distinct_by(`{}`, &amp;id)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-12 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"divide\">divide<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number divide(number $left, number $right)<\/code><\/pre>\n\n\n\n<p>Divides $left by $right.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>divide(`2`, `4`)<\/code><\/td><td><code>0.5<\/code><\/td><\/tr><tr><td><code>divide(`4`, `2`)<\/code><\/td><td><code>2<\/code><\/td><\/tr><tr><td><code>divide(`4.0`, `2`)<\/code><\/td><td><code>2<\/code><\/td><\/tr><tr><td><code>divide(`-4`, `2`)<\/code><\/td><td><code>-2<\/code><\/td><\/tr><tr><td><code>divide('4', `2`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><tr><td><code>divide([`0`, `1`], `2`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-13 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"format\">format<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string format(number|string|datetime $data, string $format, string $culture)<\/code><\/pre>\n\n\n\n<p>Formats the input $data into a string following the rules defined by $format and $culture.<br>$format is expected as a <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/base-types\/composite-formatting\" data-type=\"URL\" data-id=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/base-types\/composite-formatting\">composite formatting<\/a> string to use for parsing.<br>$culture should be a <em>language culture name<\/em>, based on <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_ISO_639-1_codes\">ISO-639-1<\/a> (ie. &#8216;<strong>en-US<\/strong>&#8216;, &#8216;<strong>es-ES<\/strong>&#8216;). If it is null or an empty string, then <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.globalization.cultureinfo.invariantculture?view=netcore-3.1\" data-type=\"URL\" data-id=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.globalization.cultureinfo.invariantculture?view=netcore-3.1\">invariant culture<\/a> is used. <\/p>\n\n\n\n<p>The function is similar to the following C# code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">string.Format(new CultureInfo($culture), $\"{{0:{$format}}}\", $data);<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>format(`0.555`, 'f', 'en-US')<\/code><\/td><td><code>'0.555'<\/code><\/td><\/tr><tr><td><code>format(`0.555`, 'F2', 'en-US')<\/code><\/td><td><code>'0.56'<\/code><\/td><\/tr><tr><td><code>format(to_datetime('02-19-2021', 'MM-dd-yyyy', 'en-US'), 'g', 'en-US')<\/code><\/td><td><code>'2\/19\/2021 12:00 AM'<\/code><\/td><\/tr><tr><td><code>format(to_datetime('02-19-2021', 'MM-dd-yyyy', 'en-US'), 'yyyy-MM-dd', 'en-US')<\/code><\/td><td><code>'2021-02-19'<\/code><\/td><\/tr><tr><td><code>format(to_datetime('3. maj, 2021', 'd. MMM, yyyy', 'da-DK'), 'd. MMM, yyyy', 'en-US')<\/code><\/td><td><code>'3. May, 2021'<\/code><\/td><\/tr><tr><td><code>format([`0`], 'd', 'en-US')<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-14 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"getproperty\">get_property<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">any get_property(json_object $object, string $key)<\/code><\/pre>\n\n\n\n<p>Returns the Value for the property with name $key in the JSON $object.<br>Compared to the <em>dot accessor<\/em> (&#8220;.&#8221;), <code>get_property <\/code>allows you to provide a <code>string <\/code>instead of &#8220;knowing&#8221; the property name beforehand (ie. <code>object.property<\/code> vs <code>get_property(object, \"property\")<\/code>).<\/p>\n\n\n\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"FirstName\": \"John\",\n&nbsp; &nbsp; \"LastName\": \"Doe\",\n&nbsp; &nbsp; \"Age\": 30,\n&nbsp; &nbsp; \"Status\": {\n&nbsp; &nbsp; &nbsp; &nbsp; \"Enabled\": true\n&nbsp; &nbsp; },\n&nbsp; &nbsp; \"Roles\": [\n&nbsp; &nbsp; &nbsp; &nbsp; \"User\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"Admin\"\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>get_property(input, \"FirstName\")<\/code><\/td><td><code>\"John\"<\/code><\/td><\/tr><tr><td><code>get_property(input, \"Age\")<\/code><\/td><td><code>30<\/code><\/td><\/tr><tr><td><code>get_property(input, \"Status\")<\/code><\/td><td><code>{\"Enabled\": true}<\/code><\/td><\/tr><tr><td><code>get_property(input, \"Roles\")<\/code><\/td><td><code>[\"User\", \"Admin\"]<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-15 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"getrestapi\">get_rest_api<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object get_rest_api(string $baseUri, json_object $uriParameters, boolean $throwOnError)<\/code><\/pre>\n\n\n\n<p>Sends a GET request to the specified $baseUri using $uriParameters to fill out its query, and returns a JSON with the result.<br>The $baseUri parameter should present its query portion as placeholders, akin to <a href=\"#stringinterpolate\" data-type=\"internal\" data-id=\"#stringinterpolate\">string_interpolate<\/a>.<br>In case of failure, the $throwOnError flag determines whether to allow the error to reach JMES (<em>true<\/em>) or just return <code>null <\/code>(<em>false<\/em>).<\/p>\n\n\n\n<pre title=\"example\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">get_rest_api(\n\"https:\/\/exampleservice.com\/api?id={userId}\",\n{ \"userId\": 123456 },\n`true`)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-17 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"groupadjacent\">group_adjacent<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array group_adjacent(array $entry, &amp;groupExpression)<\/code><\/pre>\n\n\n\n<p>Groups adjacent elements of an input array based on &amp;groupExpression. The functions returns an array of arrays, where each nested array contains grouped entries of $entry.<\/p>\n\n\n\n<div class=\"wp-container-16 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"entry\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foobar\", \"id\": 1234},\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foo\", \"id\": 56789},\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"bar\", \"id\": 56789},\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"baz\", \"id\": 1234},\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foo-bar\", \"id\": 1234}\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">group_adjacent(entry, &amp;id)<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foobar\", \"id\": 1234 }\n&nbsp; &nbsp; ],\n&nbsp; &nbsp; [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foo\", \"id\": 56789 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"bar\", \"id\": 56789 }\n&nbsp; &nbsp; ],\n&nbsp; &nbsp; [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"baz\", \"id\": 1234 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"a\": \"foo-bar\", \"id\": 1234 }\n&nbsp; &nbsp; ]\n]<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-18 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"hasvalue\">has_value<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">bool has_value(any $entry)<\/code><\/pre>\n\n\n\n<p>Returns an indication of whether or not $entry has a value, based on the following critera:<\/p>\n\n\n\n<ul id=\"block-96a034e5-bc58-414c-a94a-5f4d8a3d020a\"><li>$entry is a boolean and its value is true.<\/li><li>$entry is a string and it is not null nor has the value &#8216;false&#8217;.<\/li><li>$entry is a number and is greater than 0.<\/li><li>$entry is not null.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>has_value(`true`)<\/code><\/td><td><code>true<\/code><\/td><\/tr><tr><td><code>has_value(`null`)<\/code><\/td><td><code>false<\/code><\/td><\/tr><tr><td><code>has_value('')<\/code><\/td><td><code>false<\/code><\/td><\/tr><tr><td><code>has_value('false')<\/code><\/td><td><code>false<\/code><\/td><\/tr><tr><td><code>has_value('foo')<\/code><\/td><td><code>true<\/code><\/td><\/tr><tr><td><code>has_value(`0`)<\/code><\/td><td><code>false<\/code><\/td><\/tr><tr><td><code>has_value(`1`)<\/code><\/td><td><code>true<\/code><\/td><\/tr><tr><td><code>input = {\"a\": 'foo'}, has_value(input.a)<\/code><\/td><td><code>true<\/code><\/td><\/tr><tr><td><code>input = {\"a\": 'foo'}, has_value(input.b)<\/code><\/td><td><code>false<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-19 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"if\">if<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">any if(any $condition, any $trueValue, any $falseValue)<\/code><\/pre>\n\n\n\n<p>Similar to its <em>Excel <\/em>counterpart, <code>if<\/code> returns $trueValue if $condition is true and otherwise returns $falseValue.<\/p>\n\n\n\n<p>The evaluation for $condition follows the same rules as for <a href=\"#hasvalue\" data-type=\"internal\" data-id=\"#hasvalue\">has_value<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>if(`true`, '1', '0')<\/code><\/td><td><code>'1'<\/code><\/td><\/tr><tr><td><code>if(`false`, '1', '0')<\/code><\/td><td><code>'0'<\/code><\/td><\/tr><tr><td><code>if('foo', '1', '0')<\/code><\/td><td><code>'1'<\/code><\/td><\/tr><tr><td><code>if(`null`, '1', '0')<\/code><\/td><td><code>'0'<\/code><\/td><\/tr><tr><td><code>if([`0`, `1`], '1', '0')<\/code><\/td><td><code>'1'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-21 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"items\">items<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array items(json_object $object)<\/code><\/pre>\n\n\n\n<p>Converts the JSON $object into an array of its properties, where each is broken into an array of 2: its name and its value. <\/p>\n\n\n\n<div class=\"wp-container-20 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"obj\": {\n&nbsp; &nbsp; &nbsp; &nbsp; \"name1\": \"value1\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"name2\": \"value2\"\n&nbsp; &nbsp; }\n}<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; [ \"name1\", \"value1\" ],\n&nbsp; &nbsp; [ \"name2\", \"value2\" ]\n]<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-22 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"joinhide\">join_hide<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string join_hide(string $separator, string[] $arr)<\/code><\/pre>\n\n\n\n<p>Concatenates the elements of $arr, using the specified $separator between each. Whitespace or null strings in $arr are ignored.<br>Returns an empty string if any parameter is invalid.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>join_hide(\",\", [\"1\", \"2\", \"3\"])<\/code><\/td><td><code>\"1,2,3\"<\/code><\/td><\/tr><tr><td><code>join_hide(\"\", [\"This\", \"is\", \"joined\"])<\/code><\/td><td><code>\"Thisisjoined\"<\/code><\/td><\/tr><tr><td><code>join_hide(\"\\n\", [\"Line1\", \"Line2\"])<\/code><\/td><td><code>\"Line1<\/code><br><code>Line2\"<\/code><\/td><\/tr><tr><td><code>join_hide(`null`, [\"a\", \"b\"])<\/code><\/td><td><code>\"ab\"<\/code><\/td><\/tr><tr><td><code>join_hide(\"\", `null`)<\/code><\/td><td>&#8220;&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-23 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"listjoin\">list_join<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array list_join(array $leftArray, array $rightArray, &amp;leftEvaluateBy, &amp;rightEvaluateBy)<\/code><\/pre>\n\n\n\n<p>Groups the two input lists on each their expression followed by joining the two grouped lists with respect to the selected evaluation criteria. Entries that do not have matching keys, either in $leftArray or $rightArray, are shown in the result with no matching counterpart.<\/p>\n\n\n\n<p>Returns a joined list with entries: index, list of entries from the $leftArray and a list of entries from the $rightArray for each possible combination from the join.<\/p>\n\n\n\n<p>From the following data as <code>inputJson<\/code>:<\/p>\n\n\n\n<pre title=\"inputJson\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"people\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foo\", \"teamId\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"bar\", \"teamId\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz\", \"teamId\": 2 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foobar\", \"teamId\": 3 }\n&nbsp; &nbsp; ],\n&nbsp; &nbsp; \"teams\": [\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foo-bar-team\", \"id\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz-team\", \"id\": 2 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz-team-2\", \"id\": 2 },\n&nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foobar-team-10\", \"id\": 10 }\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<p>Evaluating:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">list_join(inputJson.people, inputJson.Teams, &amp;teamId, &amp;id)<\/code><\/pre>\n\n\n\n<p>Would give us the following result:<\/p>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"__index\": 0,\n&nbsp; &nbsp; &nbsp; &nbsp; \"left\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foo\", \"teamId\": 1 },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"bar\", \"teamId\": 1 }\n&nbsp; &nbsp; &nbsp; &nbsp; ],\n&nbsp; &nbsp; &nbsp; &nbsp; \"right\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foo-bar-team\", \"id\": 1 }\n&nbsp; &nbsp; &nbsp; &nbsp; ]\n&nbsp; &nbsp; },\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"__index\": 1,\n&nbsp; &nbsp; &nbsp; &nbsp; \"left\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz\", \"teamId\": 2 }\n&nbsp; &nbsp; &nbsp; &nbsp; ],\n&nbsp; &nbsp; &nbsp; &nbsp; \"right\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz-team\", \"id\": 2 },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"baz-team-2\", \"id\": 2 }\n&nbsp; &nbsp; &nbsp; &nbsp; ]\n&nbsp; &nbsp; },\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"__index\": 2,\n&nbsp; &nbsp; &nbsp; &nbsp; \"left\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foobar\", \"teamId\": 3 }\n&nbsp; &nbsp; &nbsp; &nbsp; ],\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\"right\": [ ]\n&nbsp; &nbsp; &nbsp;},\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"__index\": 3,\n&nbsp; &nbsp; &nbsp; &nbsp; \"left\": [],\n&nbsp; &nbsp; &nbsp; &nbsp; \"right\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { \"name\": \"foobar-team-10\", \"id\": 10 }\n&nbsp; &nbsp; &nbsp; &nbsp; ]\n&nbsp; &nbsp; }\n]<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator aligncenter is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-24 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"listrangefill\">list_range_fill<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array list_range_fill(array $entry, int &amp;keySelector, int &amp;stepFunction, &amp;constructor)<\/code><\/pre>\n\n\n\n<p>Takes a list of  items containing (string)name and (integer)value, and fills missing values between $entry values. The &amp;keySelector expression points to the value element in $entry. The &amp;stepFunction expression is used to calculate the next values. If &amp;keySelector and &amp;stepFunction does is not integers an error is returned. The functions orders $entry numerically and alphabetically.<\/p>\n\n\n\n<p>The constructor is used when filling elements in the returned list. It consists of three elements:<\/p>\n\n\n\n<ul><li><code>__previous<\/code>: the previous item from the input list. This is only used for the second item of $entry onwards. It contains Name and Value of this item. <\/li><li><code>__next<\/code>: the next item from the input list, e.g. on element two, this will point to element three. It contains Name and Value of this item.<\/li><li><code>__key<\/code>: the calculated value from using &amp;stepFunction.<\/li><\/ul>\n\n\n\n<p>Filling elements in the return list is performed iteratively. The first iteration initiates the list, and defines __previous as the first item in $entry and __next as the second item in $entry. __key is updated using &amp;stepFunction for each iteration, until __key equals the value of __next. __previous is then defined as __next and __next as the next item in $entry (if any).<\/p>\n\n\n\n<p>The function returns an array of items that consists of:<\/p>\n\n\n\n<ul><li><code>Name<\/code>: Name of the previous item in $entry.<\/li><li><code>previousValue<\/code>: Value of the previous item in $entry. This field is only provided when Value (see below) is between two values in $entry.<\/li><li><code>nextValue<\/code>: Value of the next item in $entry. This field is only provided when Value (see below) is between two values in $entry.<\/li><li><code>Value<\/code>: Current value, as either calculated by &amp;stepFunction or initialized by the first item in $entry.<\/li><\/ul>\n\n\n\n<p>From the following expression based on input data <code>input<\/code>:<\/p>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">list_range_fill(input, &amp;Value, &amp;add(@,`1`), &amp;{Name:__previous.Name, previousValue:__previous.Value, nextValue:__next.Value, Value: __key})<\/code><\/pre>\n\n\n\n<p>We get the following correct result on Integer <code>value<\/code>s:<\/p>\n\n\n\n<pre title=\"proper input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n     { \"Name\": \"A\", \"Value\": 2015 },\n     { \"Name\": \"B\", \"Value\": 2017 },\n     { \"Name\": \"C\", \"Value\": 2020 }\n }<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; { \"Name\": \"A\", \"Value\": 2015 },\n&nbsp; &nbsp; { \"Name\": \"A\", \"Value\": 2016, \"previousValue\": 2015, \"nextValue\": 2017 },\n&nbsp; &nbsp; { \"Name\": \"B\", \"Value\": 2017 },\n&nbsp; &nbsp; { \"Name\": \"B\", \"Value\": 2018, \"previousValue\": 2017, \"nextValue\": 2020 },\n&nbsp; &nbsp; { \"Name\": \"B\", \"Value\": 2019, \"previousValue\": 2017, \"nextValue\": 2020 },\n&nbsp; &nbsp; { \"Name\": \"C\", \"Value\": 2020 }\n]<\/code><\/pre>\n\n\n\n<p>If our input had string values instead, we would get an error:<\/p>\n\n\n\n<pre title=\"erroneous input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n     { \"Name\": \"A\", \"Value\": \"2015\" },\n     { \"Name\": \"B\", \"Value\": \"2017\" },\n     { \"Name\": \"C\", \"Value\": \"2020\" }\n }<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-26 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"merge\">merge<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object merge(args[]:json_object $objects)<\/code><\/pre>\n\n\n\n<p>&#8220;Merges&#8221; the JSON $objects into a single one, following a <em>concatenation <\/em>(arrays\/objects) or <em>replacement<\/em> (values) logic <strong>in order<\/strong> of the arguments provided.<\/p>\n\n\n\n<div class=\"wp-container-25 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"PersonalInfo\": {\n&nbsp; &nbsp; &nbsp; &nbsp; \"FirstName\": \"John\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"LastName\": \"Doe\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"Age\": 30\n&nbsp; &nbsp; },\n&nbsp; &nbsp; \"UserInfo\": {\n&nbsp; &nbsp; &nbsp; &nbsp; \"Enabled\": false,\n&nbsp; &nbsp; &nbsp; &nbsp; \"Roles\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"User\"\n&nbsp; &nbsp; &nbsp; &nbsp; ]\n&nbsp; &nbsp; },\n&nbsp; &nbsp; \"NewUserInfo\": {\n&nbsp; &nbsp; &nbsp; &nbsp; \"Enabled\": true,\n&nbsp; &nbsp; &nbsp; &nbsp; \"Roles\": [\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Admin\"\n&nbsp; &nbsp; &nbsp; &nbsp; ]\n&nbsp; &nbsp; }\n}<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">merge(@.PersonalInfo, @.UserInfo)<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"FirstName\": \"John\",\n&nbsp; &nbsp; \"LastName\": \"Doe\",\n&nbsp; &nbsp; \"Age\": 30,\n&nbsp; &nbsp; \"Enabled\": false,\n&nbsp; &nbsp; \"Roles\": [\n&nbsp; &nbsp; &nbsp; &nbsp; \"User\"\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">merge(@.PersonalInfo, @.UserInfo, @.NewUserInfo)<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"FirstName\": \"John\",\n&nbsp; &nbsp; \"LastName\": \"Doe\",\n&nbsp; &nbsp; \"Age\": 30,\n&nbsp; &nbsp; \"Enabled\": true,\n&nbsp; &nbsp; \"Roles\": [\n&nbsp; &nbsp; &nbsp; &nbsp; \"User\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"Admin\"\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<h2>replace_properties<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">json_object replace_properties(object $object, object $properties, boolean $insertOnMissing)<\/code><\/pre>\n\n\n\n<p>Acts very similarly as <code>merge<\/code> but is able to replace <code>null<\/code> values in objects, where the merge function will preserve the original value. <\/p>\n\n\n\n<pre title=\"Input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n  \"ArticleInfo\": {\n    \"date\": \"6\/2\/2021\",\n    \"publication\": \"TheMagazine\",\n    \"article-title\": \"A title\",\n    \"reporter-name\": \"John Doe\"\n  }\n}<\/code><\/pre>\n\n\n\n<pre title=\"Transformation\" class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">{\n  \/\/Note here we cannot replace the value in reporter-name with null\n  testMerge: merge(ArticleInfo, {\"reporter-name\": `null`}),\n  \/\/Here, we can replace reporter-name with null. \n  \/\/Note also here that it is possible for us to add a value that is not present in the object (the \"NewValue1\" object). \n  \/\/This is because \"insertOnMissing is set to `true`.\n  testReplace: replace_properties(ArticleInfo, {\"reporter-name\":`null`, NewValue1: 'Test Value'}, `true`),\n  \/\/Here \"insertOnMissing\" is set to `false` and we cannot insert the value \"NewValue2\"\n  testReplaceFalse: replace_properties(ArticleInfo, {\"reporter-name\":`null`, NewValue2: 'Not inserted'}, `false`) \n}<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n  \"testMerge\": {\n    \"date\": \"6\/2\/2021\",\n    \"publication\": \"TheMagazine\",\n    \"article-title\": \"A title\",\n    \"reporter-name\": \"John Doe\"\n  },\n  \"testReplace\": {\n    \"date\": \"6\/2\/2021\",\n    \"publication\": \"TheMagazine\",\n    \"article-title\": \"A title\",\n    \"reporter-name\": null,\n    \"NewValue1\": \"Test Value\"\n  },\n  \"testReplaceFalse\": {\n    \"date\": \"6\/2\/2021\",\n    \"publication\": \"TheMagazine\",\n    \"article-title\": \"A title\",\n    \"reporter-name\": null,\n    \"NewValue1\": \"Test Value\"\n  }\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-background has-black-background-color has-black-color is-style-wide\"\/>\n\n\n\n<div class=\"wp-container-27 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"multiply\">multiply<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number multiply(number $left, number $right)<\/code><\/pre>\n\n\n\n<p>Multiplies $left with $right.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>multiply(`3`, `4`)<\/code><\/td><td><code>12<\/code><\/td><\/tr><tr><td><code>multiply(`3.0`, `4`)<\/code><\/td><td><code>12<\/code><\/td><\/tr><tr><td><code>multiply(`3.5`, `3`)<\/code><\/td><td><code>10.5<\/code><\/td><\/tr><tr><td><code>multiply(`-3.5`, `3`)<\/code><\/td><td><code>-10.5<\/code><\/td><\/tr><tr><td><code>multiply('3', `4`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><tr><td><code>multiply([`0`, `1`], `2`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-30 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"numprops\">numbered_props_to_array<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array numbered_props_to_array(json_object $object)<\/code><\/pre>\n\n\n\n<p>Get a new array of objects based on the properties from the JSON $object, where each name is considered to have an explicit (or implicit) ordering representation that defines its resulting position in the array.<br>This order index is taken from the name&#8217;s suffix, which is considered 0 when absent.<br>ie.: <code>\"Name\"<\/code> -&gt; <code>\"Name\"<\/code>, <code>0<\/code> \/ <code>\"NameIndex9\"<\/code> -&gt; <code>\"NameIndex\"<\/code>, <code>9<\/code>.<\/p>\n\n\n\n<div class=\"wp-container-28 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"a\": \"a\",\n&nbsp; &nbsp; \"b\": \"b\",\n&nbsp; &nbsp; \"c\": \"c\"\n}<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"a\": \"a\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"b\": \"b\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"c\": \"c\"\n&nbsp; &nbsp; }\n]<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-29 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"a\": \"0\",\n&nbsp; &nbsp; \"b1\": \"b\",\n&nbsp; &nbsp; \"c2\": \"c2\",\n&nbsp; &nbsp; \"c1\": \"c\",\n&nbsp; &nbsp; \"a2\": \"a2\"\n}<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"a\": \"0\"\n&nbsp; &nbsp; },\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"b\": \"b\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"c\": \"c\"\n&nbsp; &nbsp; },\n&nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; \"c\": \"c2\",\n&nbsp; &nbsp; &nbsp; &nbsp; \"a\": \"a2\"\n&nbsp; &nbsp; }\n]<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-31 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"parent\">parent<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object parent(any $entry)<\/code><\/pre>\n\n\n\n<p>Returns the first json object that is a parent of $entry.<br>If $entry has no object as an ancestor, <code>null <\/code>is returned.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Given<\/th><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>{ \"a\": 1 }<\/code><\/td><td><code>parent(a)<\/code><\/td><td><code>{ \"a\": 1 }<\/code><\/td><\/tr><tr><td><code>{ \"a\": { \"b\": 1 } }<\/code><\/td><td><code>parent(a.b)<\/code><\/td><td><code>{ \"b\": 1 }<\/code><\/td><\/tr><tr><td><code>{ \"a\": [ { \"b\": 1 }, { \"b\": 2 } ], \"c\": 3 }<\/code><\/td><td><code>a[*].{ c: parent(@).c, b: b }<\/code><\/td><td><code>[{ \"c\": 3, \"b\": 1 },{ \"c\": 3, \"b\": 2 }]<\/code><\/td><\/tr><tr><td><code>[0, 1]<\/code><\/td><td><code>parent([0])<\/code><\/td><td><code>null<\/code><\/td><\/tr><tr><td><code>{ }<\/code><\/td><td><code>parent(`null`)<\/code><\/td><td><code>null<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-32 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"replace\">replace<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string replace(string $input, string $old, string $new)<\/code><\/pre>\n\n\n\n<p>Replace $old ocurrences in $input with $new.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>replace(\"This is wrong!\", \"wrong\", \"correct\")<\/code><\/td><td><code>\"This is correct!\"<\/code><\/td><\/tr><tr><td><code>replace(\"Line1\\nLine2\", \"\\n\", \"\")<\/code><\/td><td><code>\"Line1Line2\"<\/code><\/td><\/tr><tr><td><code>replace(\"-We-Hate-Hyphens-\", \"-\", `null`)<\/code><\/td><td><code>\"WeHateHyphens\"<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-34 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2>safe_mode<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">safe_mode(input, &amp;expression)<\/code><\/pre>\n\n\n\n<p>Use safe_mode function and stay on safe side if there is any exception in the transformation block send as &#8220;input&#8221; parameter. <br>The function changes the behavior of exceptions to return null and not result in an invalid transformation.&nbsp;<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 id=\"safenotnull\">safe_not_null<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">any safe_not_null(any $entry, &amp;expressions[])<\/code><\/pre>\n\n\n\n<p>Similar to a <code>COALESCE<\/code> function, <code>safe_not_null<\/code> evaluates $entry against a set of expressions, returning on the first one that provides a non-null answer.<br>More specifically, $entry is used as input data, which would define the &#8220;scope&#8221; available for the evaluation of each expression (see example provided).<br>In the case of unsuccessful evaluation (i.e. all expressions evaluate to null or fail), it returns <code>null<\/code>.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<div class=\"wp-container-33 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{ \"str\": \"Take this and not this\" }<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">safe_not_null(@, &amp;to_number(@.str, 'en-UK'), &amp;substring(@.str, `0`, `9`), &amp;has_value(@.str))<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"markdown\" class=\"language-markdown\">'Take this'<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-35 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"service\">service<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object service(string $service, string $operation, any $payload)<\/code><\/pre>\n\n\n\n<p>Fetches data from an external service by calling a <a href=\"https:\/\/info.documotor.com\/?page_id=2169\">Connected <code>$Service<\/code><\/a>&#8216;s <code>$operation<\/code> with <code>$payload<\/code>.<\/p>\n\n\n\n<p>For operations utilizing GET, $payload must be a flat key\/value object.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-36 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"split\">split<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object split(array $input, integer $count)<\/code><\/pre>\n\n\n\n<p>Splits $input into two arrays &#8220;first&#8221; and &#8220;last&#8221;, one with $count elements and the other with all the elements left.<br>If $count = 0, then &#8220;first&#8221; would contain all the elements in $input.<br>If $count &gt; 0, then &#8220;first&#8221; would take only the first $count elements.<br>If $count &lt; 0, then &#8220;last&#8221; would be the one to fill first.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>split([1, 2, 3], `2`)<\/code><\/td><td><code>{ \"first\": [1, 2], \"last\": [3] }<\/code><\/td><\/tr><tr><td><code>split([1, 2, 3], `-1`)<\/code><\/td><td><code>{ \"first\": [2, 3], \"last\": [1] }<\/code><\/td><\/tr><tr><td><code>split([1, 2, 3], `0`)<\/code><\/td><td><code>{ \"first\": [1, 2, 3], \"last\": [] }<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-37 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"spliton\">split_on<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array split_on(string $input, boolean $ignore_empty, args[]:string $separators)<\/code><\/pre>\n\n\n\n<p>Simliar to a <code>string.Split<\/code> in many programming languages, <code>split_on <\/code>breaks down the string $input into an array using the string separators provided as parameters, with the flag $ignore_empty defining whether &#8220;empty&#8221; strings are included (<em>false<\/em>) or not (<em>true<\/em>).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Data<\/th><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>{ \"a\": 'ab\\n\\ncd' }<\/code><\/td><td><code>split_on(a, `true`, `\"\\n\"`)<\/code><\/td><td><code>[\"ab\", \"cd\"]<\/code><\/td><\/tr><tr><td><code>{ \"a\": 'ab\\n\\ncd' }<\/code><\/td><td><code>split_on(a, `false`, `\"\\n\"`)<\/code><\/td><td><code>[\"ab\", \"\", \"cd\"]<\/code><\/td><\/tr><tr><td><code>{<br> \"a\": 'ab\\ncd\\nef',<br> \"b\": '\\n',<br> \"c\": '\\r\\n'<br>}<\/code><\/td><td><code>split_on(a, `true`, b, c)<\/code><\/td><td><code>[\"ab\", \"cd\", \"ef\"]<\/code><\/td><\/tr><tr><td><code>{ }<\/code><\/td><td><code>split_on('AabBaC', `true`, 'a', 'ab')<\/code><\/td><td><code>[\"A\", \"B\", \"C\"]<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-38 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"stringinterpolate\">string_interpolate<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string string_interpolate(string $input, array|object $parameters)<\/code><\/pre>\n\n\n\n<p>Similar to operations like <code>format <\/code>or <code>print<\/code>, <code>interpolate <\/code>replaces the positional tokens in $input with the $parameters given, matching by index (array) or property name (object).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>string_interpolate('Hello, {0}!', [\"World\"])<\/code><\/td><td><code>\"Hello, World!\"<\/code><\/td><\/tr><tr><td><code>string_interpolate('Hello, {name}!', {\"name\": 'World'})<\/code><\/td><td><code>\"Hello, World!\"<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-39 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"substring\">substring<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string substring(string $text, integer $index, integer $length)<\/code><\/pre>\n\n\n\n<p>Returns a substring of $text, starting at $index and up to $length characters or until the end of $text.  If $text is null, the function will return <code>null<\/code>.<br>If $index is greater than the length of $text, the function will return an empty string. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>substring('FooBar', `0`, `6`)<\/code><\/td><td><code>'FooBar'<\/code><\/td><\/tr><tr><td><code>substring('FooBar', `0`, `10`)<\/code><\/td><td><code>'FooBar'<\/code><\/td><\/tr><tr><td><code>substring('FooBar', `0`, `3`)<\/code><\/td><td><code>'Foo'<\/code><\/td><\/tr><tr><td><code>substring('FooBar', `3`, `3`)<\/code><\/td><td><code>'Bar'<\/code><\/td><\/tr><tr><td><code>substring('FooBar', `10`, `3`)<\/code><\/td><td><code>''<\/code><\/td><\/tr><tr><td><code>substring(`null`, `0`, `3`)<\/code><\/td><td><code>null<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-40 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"subtract\">subtract<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number subtract(number $left, number $right)<\/code><\/pre>\n\n\n\n<p>Subtracts $right from $left.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>subtract(`3`, `4`)<\/code><\/td><td><code>-1<\/code><\/td><\/tr><tr><td><code>subtract(`3.0`, `4`)<\/code><\/td><td><code>-1<\/code><\/td><\/tr><tr><td><code>subtract(`3.5`, `4`)<\/code><\/td><td><code>-0.5<\/code><\/td><\/tr><tr><td><code>subtract(`-3.5`, `4`)<\/code><\/td><td><code>-7.5<\/code><\/td><\/tr><tr><td><code>subtract('3', `4`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><tr><td><code>subtract([`0`, `1`], `2`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-41 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"takeordefault\">take_or_default<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array take_or_default(array $array, integer $count, any $default)<\/code><\/pre>\n\n\n\n<p>Takes the first $count elements from $array.<br>If the array is smaller, then $default will be used to pad the remaining elements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>take_or_default([`1`, `2`], `0`, `5`)<\/code><\/td><td><code>[]<\/code><\/td><\/tr><tr><td><code>take_or_default([`1`, `2`], `1`, `5`)<\/code><\/td><td><code>[1]<\/code><\/td><\/tr><tr><td><code>take_or_default([`1`, `2`], `2`, `5`)<\/code><\/td><td><code>[1, 2]<\/code><\/td><\/tr><tr><td><code>take_or_default([`1`, `2`], `3`, `5`)<\/code><\/td><td><code>[1, 2, 5]<\/code><\/td><\/tr><tr><td><code>take_or_default([`1`, `2`], `5`, 'a')<\/code><\/td><td><code>[1, 2, 'a', 'a', 'a']<\/code><\/td><\/tr><tr><td><code>take_or_default(`null`, `3`, `5`)<\/code><\/td><td><code>Error<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-42 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"template\">template<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string template(string $id, string $stage, any $inputData)<\/code><\/pre>\n\n\n\n<p>Generates a base64-encoded document based on the provided <em><strong>DocuMotor <\/strong><\/em>template $id, its $stage (or <code>null <\/code>if none), and $inputData.<br>This data does not have any specific restrictions to its shape: it canbe either a json_object, a simple value, or nothing at all.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-43 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"todatetime\">to_datetime<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">datetime to_datetime(string $data, string $format, string $culture)<\/code><\/pre>\n\n\n\n<p id=\"format\">Converts a string to a standardized datetime object.<br>$format is expected as a <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/base-types\/standard-date-and-time-format-strings\" data-type=\"URL\" data-id=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/base-types\/standard-date-and-time-format-strings\">datetime format<\/a> string to use for parsing.<br>$culture should be a <em>language culture name<\/em>, based on <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_ISO_639-1_codes\" data-type=\"URL\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/List_of_ISO_639-1_codes\">ISO-639-1<\/a> (ie. &#8216;<strong>en-US<\/strong>&#8216;, &#8216;<strong>es-ES<\/strong>&#8216;).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_datetime('2021-02-21 12:00:00Z', 'u', 'en-US')<\/code><\/td><td><code>2021-02-21T12:00:00Z<\/code><\/td><\/tr><tr><td><code>to_datetime('3 Feb, 2021', 'd MMM, yyyy', 'en-US')<\/code><\/td><td><code>2021-02-03T00:00:00Z<\/code><\/td><\/tr><tr><td><code>to_datetime('3 February, 2021', 'd MMMM, yyyy', 'en-US')<\/code><\/td><td><code>2021-02-03T00:00:00Z<\/code><\/td><\/tr><tr><td><code>to_datetime('', 'd MMMM, yyyy', 'en-US')<\/code><\/td><td><code>null<\/code><\/td><\/tr><tr><td><code>to_datetime(`null`, 'd MMMM, yyyy', 'en-US')<\/code><\/td><td><code>null<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-44 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"todictionary\">to_dictionary<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">json_object to_dictionary(array $input, expr &amp;key, expr &amp;value)<\/code><\/pre>\n\n\n\n<p>Converts $array into an object. The value of each property in the object is an array with the results of $valueExpression allowing for multiple elements to have the same result in $keyExpression.<\/p>\n\n\n\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"a\": [\n&nbsp; &nbsp; &nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"key\": \"b\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"value\": 1\n&nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"key\": \"c\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"value\": 2\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">to_dictionary(a, &amp;key, &amp;{newValue:value})<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"b\": [\n&nbsp; &nbsp; &nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"newValue\": 1\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; ],\n&nbsp; &nbsp; \"c\": [\n&nbsp; &nbsp; &nbsp; &nbsp; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"newValue\": 2\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; ]\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-45 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 id=\"tonumber\">to_number<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">number to_number(string|number $data, string $culture)<\/code><\/pre>\n\n\n\n<p>Converts a string to either an integer or a double depending on the format of the string.<br>$culture should be a <em>language culture name<\/em>, based on <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_ISO_639-1_codes\">ISO-639-1<\/a> (ie. &#8216;<strong>en-US<\/strong>&#8216;, &#8216;<strong>es-ES<\/strong>&#8216;).<br>If $data is already a number, the number is returned.<br>If $data is not a string or number, then <code>null <\/code>is returned.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_number('1.2', 'en-US')<\/code><\/td><td><code>1.2<\/code><\/td><\/tr><tr><td><code>to_number('1.2', 'en-DK')<\/code><\/td><td><code>12<\/code><\/td><\/tr><tr><td><code>to_number('1,2', 'en-US')<\/code><\/td><td><code>12<\/code><\/td><\/tr><tr><td><code>to_number('1,2', 'en-DK')<\/code><\/td><td><code>1.2<\/code><\/td><\/tr><tr><td><code>to_number(`1.2`, 'en-US')<\/code><\/td><td><code>1.2<\/code><\/td><\/tr><tr><td><code>to_number(`1.2`, 'en-DK')<\/code><\/td><td><code>1.2<\/code><\/td><\/tr><tr><td><code>to_number(`1`, 'en-US')<\/code><\/td><td><code>1<\/code><\/td><\/tr><tr><td><code>to_number(`null`, 'en-US')<\/code><\/td><td><code>null<\/code><\/td><\/tr><tr><td><code>to_number([`0`], 'en-US')<\/code><\/td><td><code>null<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n<\/div><\/div>\n\n\n\n<div class=\"wp-container-46 wp-block-buttons\"><\/div>\n\n\n\n<h2 id=\"todictionary\">to_titlecase<\/h2>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code lang=\"bash\" class=\"language-bash\">string to_titlecase(string $input, string &amp;culture)<\/code><\/pre>\n\n\n\n<p>Formats a $string into title case. The first letter of every word is made into uppercase. The function also expects a given culture for the chosen writing system.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_titlecase('make me title', 'en-US')<\/code><\/td><td><code>'Make Me Title'<\/code><\/td><\/tr><tr><td><code>to_titlecase('TITLECASE', 'en-US')<\/code><\/td><td><code>'Titlecase'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre title=\"input\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"a\": \"transform to title\"\n}<\/code><\/pre>\n\n\n\n<pre title=\"expression\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">to_titlecase(a, 'en-US')<\/code><\/pre>\n\n\n\n<pre title=\"result\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n&nbsp; &nbsp; \"a\": \"Transform To Title\"\n}<\/code><\/pre>\n\n\n\n<h2 id=\"todictionary\">to_sentencecase<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string to_sentencecase(string $input)<\/code><\/pre>\n\n\n\n<p>Formats a string into sentence case ie. first letter of every sentence will be uppercase.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_sentencecase('one sentence. two sentence')<\/code><\/td><td><code>'One sentence. Two sentence'<\/code><\/td><\/tr><tr><td><code>to_sentencecase('ONE TWO. THREE FOUR')<\/code><\/td><td><code>'One two. Three four'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"todictionary\">to_lower<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string to_lower(string $input)<\/code><\/pre>\n\n\n\n<p>Formats a string into all lower case.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_lower('ONE SENTENCE. TWO SENTENCE')<\/code><\/td><td><code>'one sentence. two sentence'<\/code><\/td><\/tr><tr><td><code>to_lower('oNe tWo. tHrEe FoUr')<\/code><\/td><td><code>'one two. three four'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"todictionary\">to_upper<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">string to_upper(string $input)<\/code><\/pre>\n\n\n\n<p>Formats a string into all upper case.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td><code>to_upper('one sentence. two sentence')<\/code><\/td><td><code>'<code>ONE SENTENCE. TWO SENTENCE<\/code>'<\/code><\/td><\/tr><tr><td><code>to_upper('<code>oNe tWo. tHrEe FoUr<\/code>')<\/code><\/td><td><code>'<code>ONE TWO. THREE FOUR<\/code>'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our implementation of JMESPath supports all of the following functions defined in the official specification: abs avg ceil contains ends_with floor join keys length map max max_by min min_by not_null reverse sort sort_by starts_with sum to_array to_string type values For further detail, see the official JMESPath specification. The function to_number is also supported, but have [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"parent":127,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/282"}],"collection":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":129,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/282\/revisions"}],"predecessor-version":[{"id":4022,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/282\/revisions\/4022"}],"up":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/127"}],"wp:attachment":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}