jsonyx.paste_values¶
- jsonyx.paste_values(current_nodes, values, operation, *, allow=NOTHING, use_decimal=False)[source]¶
Paste value to a node or values to a list of nodes.
Added in version 2.0.
- Parameters:
current_nodes (_Node |
list[_Node]) – a node or a list of nodesallow (
Container[str], default:NOTHING) – the JSON deviations fromjsonyx.allowuse_decimal (
bool, default:False) – usedecimal.Decimalinstead offloat
- Raises:
IndexError – if an index is out of range
JSONSyntaxError – if a query is invalid
KeyError – if a key is not found
TypeError – if a value has the wrong type
ValueError – if a value is invalid
- Example:
>>> import jsonyx as json >>> obj = [1, 2, 3] >>> root = [obj] >>> node = root, 0 # pointer to obj >>> json.paste_values(node, 4, {"mode": "append"}) >>> root[0] [1, 2, 3, 4]