{"id":27989,"library":"node-red-contrib-json","title":"node-red-contrib-json","description":"A Node-RED node for processing JSON objects using multiple query engines: JSONSelect, JSONPath, jq, and json-select. Current stable version is 0.2.0. Release cadence is irregular; this package is in early maintenance mode. Key differentiators include support for multiple query languages in one node and the ability to choose between lightweight (JSONSelect) and powerful (jq) engines. The jq engine requires the jq command-line tool to be installed separately, which is a notable dependency compared to pure JavaScript alternatives. The node integrates into Node-RED's flow-based programming environment, allowing visual wiring of JSON transformations.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/jimbojw/node-red-contrib-json","tags":["javascript","node-red","contrib-json","json","jsonpath","jq","jsonselect"],"install":[{"cmd":"npm install node-red-contrib-json","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-contrib-json","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-contrib-json","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"For the jq engine to work, the jq command-line tool must be installed and available in the system PATH.","package":"jq","optional":true}],"imports":[{"note":"This is a Node-RED contrib node, not a library. It is used by adding the 'contrib-json' node from the Node-RED palette after installation.","wrong":"require('node-red-contrib-json')","symbol":"contrib-json","correct":"Node-red node, installed via npm package 'node-red-contrib-json'. No JavaScript import needed; add node from Node-RED palette."}],"quickstart":{"code":"Install the package in your Node-RED user directory:\nnpm install node-red-contrib-json\nThen restart Node-RED and add a 'contrib-json' node from the palette. Configure it by selecting an engine (e.g., JSONSelect) and an expression (e.g., '.foo'). Wire input and output nodes. Deploy and send a message with msg.payload = {\"foo\": \"bar\"}. The output msg.payload will contain [\"bar\"] as an array.","lang":"javascript","description":"Shows installation, configuration, and usage of the contrib-json node with JSONSelect engine."},"warnings":[{"fix":"Install jq from https://stedolan.github.io/jq/ and ensure it is in your system PATH.","message":"jq engine requires the jq command-line tool to be installed separately; if not found, the node may fail silently or produce no output.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use the '>' combinator for direct children, e.g., '.foo > .bar' instead of '.foo .bar'.","message":"The JSONSelect engine uses recursive descent by default (like CSS), which may produce unexpected results if you are not familiar with the syntax.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check the engine documentation and handle output accordingly; use a Node-RED function node to convert if needed.","message":"Output format varies by engine: JSONSelect and JSONPath return arrays; jq returns one message per result (possibly multiple messages); json-select returns the result directly (may be array).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"If you need to preserve original payload, store it in another property before this node.","message":"The node modifies msg.payload only; other properties of the message are passed through unchanged.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install the package in your Node-RED user directory (usually ~/.node-red): cd ~/.node-red && npm install node-red-contrib-json","cause":"Node-RED cannot find the installed package, or the package was installed in the wrong directory.","error":"Error: Cannot find module 'node-red-contrib-json'"},{"fix":"Use a JSON parse node before this node to convert strings to objects.","cause":"The node expects msg.payload to be a JSON object, but receives a string or other type.","error":"Input payload must be a valid JSON object"},{"fix":"Install jq from https://stedolan.github.io/jq/ and ensure it is available in the system PATH.","cause":"The jq command-line tool is not installed or not in PATH.","error":"jq: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}