Automation based on JSON Attribute states

That’s going to be very difficult. You’d need to do a dynamic regex find and replace. I don’t even know if that’s doable with the current built in regex jinja functions.

You have to search for words without quotes and add the quotes around those words. The regex to find those words is (?<![\w"])([\w]+)(?![\w"]). But there is no way to take that result and the replace it with quotes (that i know of)

You’d be better off searching for the information you want via regex. For example, if you wanted the 4th type…

value | regex_findall_index('type : (\'.*?\'|\".*?\"|\S+)', 3)

if you wanted to find the 2nd name…

value | regex_findall_index('name : (\'.*?\'|\".*?\"|\S+)', 2)