Home: Patch JSON TiKiLa
Explanation of the basic Patch JSON TiKiLa functionality
The Patch JSON Node with TiKiLa (Tiny Kitchn Language) features is one of the most versatile and powerful nodes in the Kitchn toolset.
With it, you can transform, modify, and even create complex data objects. This can be useful in a large variety of situations. The node has two input fields: data and value. Both allow you to input data in any format (JSON, string, numbers, booleans). You can then perform a set of patches on the data (i.e. add, replace, remove and transform) certain fields and then output the resulting data object.
The node allows for TiKiLa (Tiny Kitchn Language) syntax. This gives you the powers of complex coding without actually having to know how to code.
Input Fields
field | schema | explanation |
data | any | Input the data that needs to be manipulated in this socket. |
value | any | Input the data, which needs to be added to the original object or list. Use this field only if you need to add or replace some of the values. |
patches | patches | Set up JSON patches in this field. It can add, cast, copy, move, remove, or replace operations. Specify the path to the field in the data socket that needs to be altered. In the value filed, you can either use the entire value, e.g. {{input.value}} or build messages with multiple dynamic inputs, e.g. "Hi {{input.value/name}}, welcome to {{input.value/company_name}}!” |
Output Fields
field | schema | explanation |
data | any | Outputs the data object with applied patches. |
Example
![Notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Feef8222d-8173-4b14-821a-7c6cef0c1d6c%2FFrame_1.png?table=block&id=f6167d04-264e-4c01-9c3c-77f62f44046a&cache=v2)
To understand the Patch JSON TiKiLa better, here’s an example of a basic use case. We have a data object representing some data about an employee in the data field. Now we want to add a field “department” to it by dynamically inserting whatever we pass to the value field. We do so, by adding a patch that adds inputValue(””) to the data at the /department pointer.
This is just a very simple example and doesn’t truly do the node justice as it can be used for much more complex workflows, especially when using the TiKiLa syntax. To further explore the functionality, take a look at these more in-depth descriptions of TiKiLa functions:
Video Example
Last updated on June 21, 2023