@omidteimoori/node-red-object-explorer 1.0.1
A reusable Node-RED node for safely exploring nested objects from msg, flow, and global context.
@omidteimoori/node-red-object-explorer
A custom Node-RED node for exploring JavaScript objects from msg, flow, and global context.
It helps users inspect nested data, discover available variables, return keys, values, or both, and prepare results for later logic or dropdown-style UI usage.
Links
- GitHub: https://github.com/omidteimoori/node-red-object-explorer
- npm: https://www.npmjs.com/package/@omidteimoori/node-red-object-explorer
- Package name:
@omidteimoori/node-red-object-explorer
Features
- Explore objects from:
msgflowglobal
- Resolve nested paths such as:
payloadpayload.fieldsvariables.devices[0].topicsitems[0].name
- Return:
- direct keys
- deep keys
- direct values
- deep values
- key/value pairs
- matching keys
- matching values
- matching key/value pairs
- Search by partial or exact key/path match
- Support arrays and nested objects
- Safe handling for missing paths,
null,undefined, and circular references - Optional second output for diagnostics
Installation
Install the package in the Node-RED user directory:
cd ~/.node-red
npm install @omidteimoori/node-red-object-explorer
Then restart Node-RED and refresh the editor.
Supported Versions
- Node-RED:
>=3.0.0 - Node.js:
>=16.0.0
Usage
- Open the Node-RED editor
- Drag the object explorer node into a flow
- Choose the source:
msgflowglobal
- Enter the path to explore
- Choose the mode
- Choose the output format
- Optionally enter a search term
Example Flow
The package includes a small example flow in the examples folder. In Node-RED, open the import menu and look under the Examples section for Basic Object Exploration.
Modes
direct_keysReturns the immediate child keys of the selected objectdeep_keysReturns all nested keys below the selected objectdirect_valuesReturns the immediate child valuesdeep_valuesReturns all nested valueskey_value_pairsReturns keys and values togethermatching_keysReturns keys or paths that match the search termmatching_valuesReturns values under matching keysmatching_key_value_pairsReturns matching paths, keys, and values together
Output
The node writes the main result to msg.payload.
It also sets:
msg.countmsg.sourcePathmsg.searchTermmsg.mode
Output 1
Main result data.
Output 2
Diagnostic status data for:
- success
- no-match
- error cases
This can be useful for debug panels, status handling, or logging.
Example Use Cases
Get direct keys from msg.payload
- Source:
msg - Path:
payload - Mode:
direct_keys
Example result:
[
"device1",
"device2"
]
Get nested values under msg.payload
- Source:
msg - Path:
payload - Mode:
deep_values
Get all packet objects below msg.payload
- Source:
msg - Path:
payload - Mode:
matching_values - Search:
packet - Recursive:
true - Exact match:
true
Example result:
[
{
"packet1": 1,
"packet2": 2
},
{
"packetX1": "Y1",
"packetX2": "Y2"
}
]
Build dropdown options from nested keys
- Source:
msg - Path:
payload.fields - Mode:
deep_keys - Output:
dropdown_options - Selected item:
path
Example 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"
}
]
Notes
- The node is designed to help users explore unknown or deeply nested structures without writing repeated Function node code.
- If a path does not exist, the node does not crash. It sends a diagnostic message to the second output.
- Arrays are supported when
Include arraysis enabled.
Related
Author
Developed by Omid Teimoori
MIT License