Leaf Iterator

The leaf iterator is useful in cases where you have a key representing a path through a JSON tree to a node that contains a value. For input such as this:

    "interaction": {
        "id": 12345,
        "tag_tree": {
            "skills": {
                "programming": ["PHP", "Java"]

You can create an iterator that writes one database row for each item in the array:

[TAGS :iter = leaf_iterator(interaction.tag_tree)]
PATH = :iter._path
VAL = :iter._value

The database table looks like this:

skills.programming PHP
skills.programming Java

PATH and VAL are constructed from the data in the interaction. The underscores in _path and _value in the INI file indicates that the data is built on the fly rather than simply pulled directly from the interaction.