node-red-object-explorer for Node-RED | Omid Teimoori
The node-red-object-explorer package is a custom Node-RED node for inspecting nested JavaScript data without writing repeated Function node logic. It resolves values from msg, flow, and global context, supports dot and bracket notation paths, and returns keys, values, paths, or structured pairs in formats that are ready for downstream logic or dashboard UI elements.
The published package targets Node-RED 3+ and Node.js 16+, and exposes one main output for results plus a second output for diagnostics and status handling.
Table of Contents
What It Does
- Explores objects from
msg,flow, andglobal. - Resolves nested paths such as
payload.fields,items[0].name, andvariables.devices[0].topics. - Returns direct keys, deep keys, direct values, deep values, key/value pairs, and filtered matches.
- Supports partial or exact matching with optional case sensitivity.
- Traverses arrays and nested objects safely, including circular-reference protection.
- Shapes output as selected arrays, strings, values, key/value objects, dropdown options, plain objects, or first-match-only results.
Supported Modes
direct_keysreturns the immediate child keys of the selected object.deep_keyswalks the full nested structure and returns all child keys.direct_valuesreturns immediate child values.deep_valuesreturns all nested values below the selected path.key_value_pairsreturns keys and values together, with optional recursive traversal.matching_keys,matching_values, andmatching_key_value_pairsfilter by search term against both key names and full paths.
Installation
Simply open your Node-RED editor and install the pallet:
@omidteimoori/node-red-object-explorer
Or install the package inside the Node-RED user directory, then restart Node-RED and refresh the editor.
cd ~/.node-red
npm install @omidteimoori/node-red-object-explorer
Editor Configuration
The node editor exposes the same controls documented in the package README and Node-RED help panel:
- Source: choose
msg,flow, orglobal. - Path: provide a nested path such as
payloadorvariables.devices[0].topics. - Mode: choose how records are collected from the target object.
- Search: optionally filter keys or paths by text.
- Output: return selected items, strings, raw values, structured objects, dropdown options, or the first match only.
- Selected Item: choose whether the result should emphasize the key, full path, value, or path/value pairs where that mode allows it.
- Traversal flags: recursive search, exact match, case sensitivity, array inclusion, and inclusion of raw values in structured outputs.
This makes the node practical for debugging unknown payloads, populating dashboard selectors, inspecting deeply nested API responses, and extracting only the part of a structure that later flow logic needs.
Example Use Cases
Example 1: list top-level device keys from msg.payload
Source: msg
Path: payload
Mode: direct_keys
Result:
[
"deviceA",
"deviceB"
]
Example 2: build dropdown-ready options from nested field paths
Source: msg
Path: payload.fields
Mode: deep_keys
Output: dropdown_options
Selected Item: path
Result:
[
{
"label": "msg.payload.fields.temperature.value",
"value": "msg.payload.fields.temperature.value"
},
{
"label": "msg.payload.fields.temperature.updatedAt",
"value": "msg.payload.fields.temperature.updatedAt"
}
]
Example 3: find matching packet objects anywhere below a payload
Source: msg
Path: payload
Mode: matching_values
Search: packet
Recursive: true
Exact match: true
Result:
[
{
"packet1": 1,
"packet2": 2
},
{
"packetX1": "Y1",
"packetX2": "Y2"
}
]
The package also ships with a Node-RED example flow named Basic Object Exploration, which injects a sample object, runs the node in direct_keys mode, and shows both the main result and the diagnostic output in Debug nodes.
Outputs and Diagnostics
The primary output writes the main result to msg.payload. The node also sets helper fields including msg.count, msg.sourcePath, msg.searchTerm, msg.mode, and msg.explorer.
The second output emits diagnostic messages for successful exploration, no-match cases, and error states such as missing paths. That behaviour matters in production flows because it lets you route status handling, logging, or UI feedback separately instead of mixing diagnostics into the main payload path.
Related pages:
node-red-data-generator |
node-red-opcua-otmr |
All projects
Read more here: Source link
