Add Dumas JSON utility batch

This commit is contained in:
2026-07-21 11:03:17 +00:00
parent 24d8ac5e14
commit 4ad9e93b63
3 changed files with 366 additions and 0 deletions

View File

@@ -24,6 +24,21 @@
- Output: updated `JSON`
- Writes a parsed JSON value into a nested path without mutating the original object.
- `Dumas JSON Has Key`
- Inputs: `json_object`, `path`
- Output: `BOOLEAN`
- Checks whether a nested path exists.
- `Dumas JSON Remove Key`
- Inputs: `json_object`, `path`
- Output: updated `JSON`
- Removes a nested key or array item by path.
- `Dumas JSON Pick Fields`
- Inputs: `json_object`, `paths`
- Output: filtered `JSON`
- Builds a new object from newline-separated paths that exist in the input.
- `Dumas JSON Merge Objects`
- Inputs: `base_object`, `overlay_object`
- Output: merged `JSON`
@@ -39,6 +54,16 @@
- Output: `INT`
- Returns the length of a JSON array.
- `Dumas JSON Array Append`
- Inputs: `json_array`, `value_json`
- Output: updated `JSON`
- Appends a parsed JSON value to the end of an array.
- `Dumas JSON Array Slice`
- Inputs: `json_array`, `start`, `end`, `step`
- Output: sliced `JSON`
- Returns an array slice. `end=0` means "slice to the end".
- `Dumas JSON Array Iterator`
- Inputs: `json_input`, `index`, `mode`
- Outputs: `item`, `current_index`, `total_items`
@@ -49,6 +74,16 @@
- Outputs: `key`, `value`, `current_index`, `total_items`
- Returns the current object entry in insertion order, with `mode` set to `fixed`, `incr`, or `decr`.
- `Dumas JSON Flatten`
- Input: `json_input`
- Output: flat `JSON`
- Flattens nested objects and arrays into dot-path keys.
- `Dumas JSON Unflatten`
- Input: `flat_json_object`
- Output: nested `JSON`
- Rebuilds nested JSON from a flat dot-path object.
All nodes live in the `Dumas/JSON` category.
## Installation
@@ -87,6 +122,16 @@ settings.render.width
{"enabled": true, "retries": 3}
```
`Dumas JSON Pick Fields` expects one path per line:
```text
user.name
meta.active
items.0.id
```
`Dumas JSON Array Slice` treats `end=0` as "use the rest of the array".
`Dumas JSON Array Iterator` clamps to valid bounds:
```text
@@ -97,6 +142,8 @@ decr -> use index - 1
`Dumas JSON Object Iterator` uses the same index rules and iterates object entries in their existing key order.
`Dumas JSON Flatten` and `Dumas JSON Unflatten` use the same dot-path format as the other path-based nodes.
## Roadmap
This repo is intended to grow into a broader set of Dumas-branded generic utility nodes, including JSON helpers and adjacent data-manipulation tools.