Find Subtree Value (vuo.tree.find)

Converts the data contained in a subtree to a chosen data type.

Searches the tree and each of its descendants for one whose name is Name (case-insensitive match). For the first matching subtree found, this node converts the data contained in the subtree to the output port’s data type.

If the output port’s data type is Text, Integer, Real, or Boolean, this node interprets the subtree’s content as that data type. For example:

Data typeTreeOutput
IntegerTree with content 10241024
BooleanTree with content truetrue

If the output port’s data type is 2D Point, 3D Point, 4D Point, or Color, this node interprets the subtree’s content or children as the components of that data type. For example:

Data typeTreeOutput
2D PointTree created from XML <location><x>1.2</x><y>3.4</y></location>1.2, 3.4
3D PointTree created from JSON {"coordinates": {"x":1.2, "y":3.4, "z":5.6}}1.2, 3.4, 5.6
4D PointTree created from XML <point><x>1.2</x><y>3.4</y><z>5.6</z><w>7.8</w></point>1.2, 3.4, 5.6, 7.8
4D PointTree with content 1.2, 3.4, 5.6, 7.81.2, 3.4, 5.6, 7.8
ColorTree created from JSON {"foreground": {"r":1, "g":0, "b":0, "a":1}}opaque red
ColorTree with content 1.0, 0.0, 0.0, 1.0opaque red
ColorTree with content #00FF00opaque green

This node is a shortcut for Find Subtrees with Name -> Get First Item in List -> Convert Tree to Value.

Keywords: convert, element, filter, json, object, search, seek, tag, xml


Example composition:


Back to vuo.tree node set documentation.