Patch JSON TiKiLa

Learn how to use the Patch JSON TiKiLa Node and build complex functions without code.

 

In this webinar, we take a look at the powerful and versatile Patch JSON TiKILa Node. This node lets you transform and create complex data objects. TiKiLa is the Tiny Kitchn Language that lets you build powerful automations without code.

 

To follow along, you can copy this automation into your account:

{"name":"Patch JSON TiKiLa Webinar","description":"A blank recipe","nodes":{"input_any_1":{"type":"input_any","logging_enabled":false,"error_rules":[],"x":775,"y":467,"inputs":{"any":{"title":"demo_fb_insights_list","description":"The any to input","export_enabled":true,"data":[{"clicks":200,"spend":1550,"conversions":10,"time":"2023-06-21T00:34:27+02:00","status":"ACTIVE","impressions":750},{"clicks":180,"spend":3270,"conversions":7,"time":"2023-06-22T14:34:27+02:00","status":"ACTIVE"},{"clicks":350,"spend":4120,"conversions":9,"time":"2023-06-23T14:21:15+02:00","status":"PAUSED"}]}},"outputs":{"any":{"title":"demo_fb_insights_list","description":"The any to input"}}},"start_1":{"type":"start","logging_enabled":false,"error_rules":[],"x":20,"y":39},"stop_1":{"type":"stop","logging_enabled":false,"error_rules":[],"x":39,"y":94,"inputs":{"stop":{"export_enabled":true}}},"patch_json_v3_1":{"type":"patch_json_v3","title":"Math: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":985,"y":638,"group":"group_1","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/add_1_to_3","value":"{{\n\n    add(1, 3)\n\n}}"},{"op":"add","path":"/subtract_1_from_2","value":"{{\n\n    subtract(2, 1)\n\n}}"},{"op":"add","path":"/multiply_2_with_4","value":"{{\n\n    multiply(2, 4)\n\n}}"},{"op":"add","path":"/divide_6_by_3","value":"{{\n\n    divide(6, 3)\n\n}}"},{"op":"add","path":"/divideOrNull_5_by_0","value":"{{\n\n    divideOrNull(5, 0)\n\n}}"},{"op":"add","path":"/divideOrZero_5_by_0","value":"{{\n\n    divideOrZero(5, 0)\n\n}}"},{"op":"add","path":"/modulo_5_by_3","value":"{{\n\n    modulo(5, 3)\n\n}}"},{"op":"add","path":"/round_314159_to_2","value":"{{\n\n    round(3.14159, 2)\n    \n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}},"patch_json_list_v3_1":{"type":"patch_json_list_v3","title":"Example: Calculate Metrics - Patch JSON List Tikila","description":"Apply JSON patches against data list with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1402,"y":368,"group":"group_1","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/cost_per_conversion","value":"{{\n    round(\n        divideOrNull(\n            divide(\n                inputData(\"/spend\"),\n                100\n            ),\n            inputData(\"/conversions\")\n        ),\n        2\n    )\n\n}}"}]},"value":{"export_enabled":true}}},"input_any_2":{"type":"input_any","logging_enabled":false,"error_rules":[],"x":1094,"y":454,"group":"group_2","inputs":{"any":{"title":"demo_ids","description":"The any to input","export_enabled":true,"data":["1238d93g24c7234","46283248e2fv349","36239ff4529d374","048304r9d293720","038k4628d349o30","dkfj342uf823821"]}},"outputs":{"any":{"title":"demo_ids","description":"The any to input"}}},"input_string_1":{"type":"input_string","logging_enabled":false,"error_rules":[],"x":1092,"y":277,"group":"group_2","inputs":{"string":{"title":"demo_api_url","description":"A string to input","export_enabled":true,"data":"https://exampleapi.com/posts?ids="}},"outputs":{"string":{"title":"demo_api_url","description":"A string to input"}}},"patch_json_v3_2":{"type":"patch_json_v3","title":"Data \u0026 Strings: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":756,"y":283,"group":"group_2","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/cast","value":"{{\n\n    cast(\"123\", \"integer\")\n\n}}"},{"op":"add","path":"/concat_hello_world","value":"{{\n\n    concat(\"hello\", \"world\")\n\n}}"},{"op":"add","path":"/dump_hello","value":"{{\n\n    dump(\"hello\")\n\n}}"},{"op":"add","path":"/joinStrings_n","value":"{{\n\n    joinStrings([\"Bob\",\"Alice\",\"Jim\", \"Devon\"], \", \")\n\n}}"},{"op":"add","path":"/splitString","value":"{{\n\n    splitString(\"these|variables|should|be|a|list\", \"|\")\n\n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}},"patch_json_v3_3":{"type":"patch_json_v3","title":"mapToObject: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":732,"y":741,"group":"group_2","inputs":{"patches":{"export_enabled":true,"data":[{"op":"replace","path":"/campaigns","value":"{{\n\n    mapToObject(inputData(\"/campaigns\"), \"/id\")\n    \n}}"}]},"data":{"export_enabled":true,"data":{"campaigns":[{"id":"abc","spend":2000},{"id":"def","spend":1785},{"id":"ezr","spend":7238},{"id":"ejo","spend":1230}]}},"value":{"export_enabled":true}}},"patch_json_v3_4":{"type":"patch_json_v3","title":"Time and Date: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":672,"y":512,"group":"group_3","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/formatTime","value":"{{\n\n    formatTime(\"2023-07-28T12:57:44+00:00\", \"%Y-%m-%d\")\n\n}}"},{"op":"add","path":"/parseTime","value":"{{\n\n    parseTime(inputData(\"/formatTime\"), \"%Y-%m-%d\")\n\n}}"},{"op":"add","path":"/timeAt_Madrid","value":"{{\n\n    timeAt(\"2023-07-28T12:57:44+00:00\", \"Europe/Madrid\")\n\n}}"},{"op":"add","path":"/timeDuration","value":"{{\n\n    timeDuration(\"2023-07-05T11:00:00+00:00\", \"2023-07-05T12:00:00+00:00\")\n\n}}"},{"op":"add","path":"/timeNow","value":"{{\n    \n    timeNow(\"UTC\")\n    \n}}"},{"op":"add","path":"/unixToTime","value":"{{\n\n    unixToTime(1685445104, \"UTC\")\n\n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}},"patch_json_v3_5":{"type":"patch_json_v3","title":"Example: Patch API URL - Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1392,"y":253,"group":"group_2","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"","value":"{{\n\n    concat(\n        inputData(\"\"),\n        joinStrings(inputValue(\"\"),\",\")\n    )\n\n}}"}]}}},"patch_json_v3_6":{"type":"patch_json_v3","title":"Random Generators: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1142,"y":449,"group":"group_4","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/randomInteger","value":"{{\n\n    randomInteger(1, 100)\n\n}}"},{"op":"add","path":"/randomString","value":"{{\n\n    randomString(7)\n    \n}}"},{"op":"add","path":"/randomWord","value":"{{\n\n    randomWord()\n\n}}"},{"op":"add","path":"/randomUuid","value":"{{\n\nrandomUuid()\n\n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}},"data_relay_1":{"type":"data_relay","logging_enabled":false,"error_rules":[],"x":960,"y":155,"group":"group_5","inputs":{"data":{"title":"data_list","description":"Data to relay"}}},"patch_json_list_v3_2":{"type":"patch_json_list_v3","title":"Example: Logic - Patch JSON List Tikila","description":"Apply JSON patches against data list with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1341,"y":189,"group":"group_5","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/spend_too_high_and_active","value":"{{\n    \n    if(\n        equals(inputData(\"/status\"),\"ACTIVE\"),\n        if(\n            greater(inputData(\"/spend\"),2000),\n            \"true\",\n            \"false\"\n        ),\n        \"false\"\n    )\n}}"}]},"value":{"export_enabled":true}}},"patch_json_v3_7":{"type":"patch_json_v3","title":"Logic: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":772,"y":438,"group":"group_5","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/equals_1_1","value":"{{\n\n    equals(1,1)\n    \n}}"},{"op":"add","path":"/notEquals_1_2","value":"{{\n\n    notEquals(1, 2)\n\n}}"},{"op":"add","path":"/greater_4_6","value":"{{\n\n    greater(4, 6)\n    \n}}"},{"op":"add","path":"/greaterOrEquals_5_5","value":"{{\n\n    greaterOrEquals(5, 5)\n    \n}}"},{"op":"add","path":"/less_3_6","value":"{{\n\n    less(3, 6)\n    \n}}"},{"op":"add","path":"/lessOrEquals_2_2","value":"{{\n\n    lessOrEquals(2, 2)\n    \n}}"},{"op":"add","path":"/if_greater_2_4_true_false","value":"{{\n\n    if(greater(2, 4), \"2 is greater than 4\", \"2 is less than 4\")\n\n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}},"data_relay_2":{"type":"data_relay","logging_enabled":false,"error_rules":[],"x":1021,"y":279,"group":"group_1"},"data_relay_3":{"type":"data_relay","logging_enabled":false,"error_rules":[],"x":902,"y":181,"group":"group_3"},"patch_json_v3_8":{"type":"patch_json_v3","title":"mapToObject: Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":991,"y":783,"group":"group_2","inputs":{"patches":{"export_enabled":true,"data":[{"op":"replace","path":"/campaigns","value":"{{\n\n    objectValues(inputData(\"\"))\n    \n}}"}]},"value":{"export_enabled":true}}},"patch_json_list_v3_3":{"type":"patch_json_list_v3","title":"Example: Date in New York Patch JSON List Tikila","description":"Apply JSON patches against data list with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1490,"y":355,"group":"group_3","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"/timeAtNewYork","value":"{{\n\n    timeAt(inputData(\"/time\"), \"America/New_York\")\n\n}}"},{"op":"add","path":"/dateInNewYork","value":"{{\n\n    formatTime(inputData(\"/timeAtNewYork\"), \"%d %B %Y\")\n\n}}"}]},"value":{"export_enabled":true}}},"patch_json_v3_9":{"type":"patch_json_v3","title":"Example: Get Yesterday's Date Patch JSON Tikila","description":"Apply JSON patches against data with Tikila support","logging_enabled":false,"max_job_retries":6,"timeout":30,"error_rules":[],"x":1101,"y":523,"group":"group_3","inputs":{"patches":{"export_enabled":true,"data":[{"op":"add","path":"","value":"{{\n\n    formatTime(unixToTime(subtract(cast(formatTime(timeNow(\"UTC\"),\"%s\"),\"integer\"),86400), \"UTC\"),\"%m/%d/%Y\")\n\n\n}}"}]},"value":{"export_enabled":true},"data":{"export_enabled":true}}}},"edges":[{"id":"data_relay_1.data:patch_json_list_v3_2.data_list","points":[]},{"id":"input_any_1.any:data_relay_1.data","points":[]},{"id":"data_relay_2.data:patch_json_list_v3_1.data_list","points":[]},{"id":"input_any_1.any:data_relay_2.data","points":[]},{"id":"input_any_1.any:data_relay_3.data","points":[]},{"id":"patch_json_v3_3.data:patch_json_v3_8.data","points":[]},{"id":"data_relay_3.data:patch_json_list_v3_3.data_list","points":[]},{"id":"input_string_1.string:patch_json_v3_5.data","points":[]},{"id":"input_any_2.any:patch_json_v3_5.value","points":[]}],"groups":{"group_1":{"title":"TiKiLa Math Operations","description":"","x":1066,"y":469,"inputs":["data_relay_2.data"]},"group_5":{"title":"TiKiLa Logic Operations","description":"","x":1349,"y":475,"inputs":["data_relay_1.data"]},"group_4":{"title":"TiKiLa Random Generators","description":"","x":1359,"y":762},"group_3":{"title":"TiKiLa Time and Date Functions","description":"","x":1621,"y":760,"inputs":["data_relay_3.data"]},"group_2":{"title":"TiKiLa Data \u0026 String Manipulation","description":"","x":1075,"y":762}},"widgets":{},"variables":{},"config":{"capture_inputs_enabled":false,"caching_enabled":false},"tags":[]}
 

Also, refer to the full Patch JSON TiKiLa documentation here:

Did this answer your question?
😞
😐
🤩

Last updated on July 20, 2023