L_obj¶
L_obj represents arbitrary nested data with two container types: MAP and ARRAY. Values can be any type: STRING, INTEGER, FLOAT, BOOL, NULL, DATETIME, DATE, TIME, MAP, ARRAY.
Container Types¶
- MAP – Holds a mapping of string keys to values
- ARRAY – Holds an ordered list of values
Basic Usage¶
Building an object¶
L_obj_new obj
L_obj_set_typed obj name = STRING "MyApp"
L_obj_set_typed obj version = STRING "1.0.0"
The = argument immediately follows the path parts, separating them from the type and value:
L_obj_set_typed <obj> <parts...> = <type> [value]
The = is the argument right after the last path part (or right after <obj> when no path parts are given). The <value> is optional — defaults to "". Container types (MAP, ARRAY) and NULL ignore it entirely. If you need a path part literally named =, provide a value (e.g., = MAP "") to disambiguate.
Auto-creation of intermediate nodes¶
L_obj_set_typed and L_obj_set auto-create intermediate container nodes as you descend. The type of each missing intermediate node is determined by the next path part descended into:
- MAP — when the next path part is a string key (anything other than
"0") - ARRAY — when the next path part is
"0"(integer index)
Note: A key named
"0"always creates an ARRAY child. To have a MAP with a key"0", explicitly create it first withL_obj_set_typed obj path = MAP.
L_obj_set_typed obj server host = STRING "localhost"
# Auto-creates: root MAP -> child "server" (MAP) -> grandchild "host" (STRING)
L_obj_set_typed obj arr 0 = STRING "first"
# Auto-creates: root MAP -> child "arr" (ARRAY) -> index 0 (STRING)
Only the final node gets its specified type; intermediate nodes default to MAP (or ARRAY when descending via index 0).
Auto-creation with L_obj_array_append_typed¶
L_obj_array_append_typed also auto-creates the target ARRAY if it doesn't exist, and can append container types (MAP, ARRAY):
# 'items' does not exist yet; auto-created as ARRAY, STRING appended at index 0
L_obj_array_append_typed obj items += STRING "first"
# Append an empty MAP, capturing its position with -v
L_obj_array_append_typed -v pos obj users += MAP
L_obj_set_typed obj+${pos} name = STRING "Alice"
Value type inference with L_obj_set¶
L_obj_set infers the type from the value:
- INTEGER – whole numbers (e.g.
42,-7) - FLOAT – numbers with a decimal point or exponent (e.g.
3.14,-2.5e10,1E3) - BOOL –
trueandfalse - STRING – everything else (including
+100, since a leading+is not valid JSON)
L_obj_set obj count = 42 # INTEGER
L_obj_set obj pi = 3.14 # FLOAT
L_obj_set obj active = true # BOOL
L_obj_set obj name = "MyApp" # STRING
L_obj_set obj exp = 1e10 # FLOAT
L_obj_set_default works the same but only sets the value if the node is not already set.
Appending values¶
L_obj_array_append appends to an ARRAY with type inferred from the value:
L_obj_set_typed obj arr = ARRAY
L_obj_array_append obj arr += 1 # INTEGER
L_obj_array_append obj arr += 2.5 # FLOAT
L_obj_array_append obj arr += "text" # STRING
L_obj_array_append_typed is the explicit-type counterpart, with optional <value> and -v <var> to capture the new element's position:
L_obj_array_append_typed [-v <var>] obj <parts...> += <type> [value]
L_obj_array_append_typed obj arr += INTEGER 42
L_obj_array_append_typed obj arr += STRING "text"
L_obj_array_append_typed obj arr += FLOAT 3.14
L_obj_array_append_typed obj arr += BOOL true
L_obj_array_append_typed obj arr += NULL
L_obj_string_append appends text to an existing STRING node:
L_obj_set_typed obj msg = STRING "Hello"
L_obj_string_append obj msg += ", World"
L_obj_get -v RESULT obj msg # "Hello, World"
Reading values¶
L_obj_get -v name obj name # "MyApp"
L_obj_get -v version obj version # "1.0.0"
Building nested objects¶
L_obj_set_typed obj server = MAP
L_obj_set_typed obj server host = STRING "localhost"
L_obj_set_typed obj server port = INTEGER 8080
L_obj_get -v host obj server host # "localhost"
L_obj_get -v port obj server port # 8080
Position references (obj+<pos>)¶
L_obj_pos returns the numeric index of a node in the flat internal array. You can then use obj+<pos> to access that node directly, avoiding full path traversal from the root:
L_obj_set_typed obj a b c = STRING "deep"
L_obj_pos -v pos obj a b c # pos = index of obj.a.b.c
L_obj_get -v val "obj+${pos}" # "deep"
This is especially useful in loops:
# Efficient: resolve position once, reuse child positions directly
L_obj_pos -v pos obj a b
while L_obj_iter "obj+${pos}" it key val type child_pos; do
L_obj_get -v name "obj+${child_pos}" name
done
Position validity¶
A position is invalidated when the node at that position is freed:
L_obj_rm— removes a node and its subtreeL_obj_clear— frees children of a containerL_obj_new— reallocates the entire objectL_obj_copy— replaces the destination's children with a deep copyL_obj_merge— replaces destination children with merged contentL_obj_array_pop— removes the last element of an ARRAYL_obj_array_shift— removes the first element of an ARRAY
Adding nodes (L_obj_set_typed, L_obj_array_append, etc.) never invalidates existing positions — new nodes are appended at the end or placed into freed slots without moving existing nodes. Only removal invalidates.
L_obj_is_valid checks whether a position still points to a non-FREE node, but it does not guarantee the position refers to the original node — a freed slot may be reused by a subsequent allocation.
Best practice: Get positions once and reuse them freely. Adding nodes never invalidates positions — only removals (
L_obj_rm,L_obj_clear,L_obj_new,L_obj_copy,L_obj_merge,L_obj_array_pop,L_obj_array_shift) do.
Container lifecycle¶
| Function | What it does | Use for |
|---|---|---|
L_obj_new obj [type] |
Reinitializes to empty | Starting fresh or resetting |
L_obj_clear obj [parts...] |
Removes children; preserves the container ({} / []) |
Emptying an existing MAP or ARRAY |
L_obj_rm obj [parts...] |
Removes the node and its subtree entirely | Deleting a key or subtree |
When L_obj_new is called without a type (e.g., L_obj_new obj), it creates an empty, untyped object. The first L_obj_set_typed call then determines the root type through path descent. When a type is specified (e.g., L_obj_new obj MAP), the root node is immediately created with that type.
Use
L_obj_newto initialize — notL_obj_clear.
L_obj_clear — empty an existing container¶
L_obj_set_typed obj data = MAP
L_obj_set_typed obj data a = STRING "x"
L_obj_set_typed obj data b = STRING "y"
L_obj_clear obj data # obj.data is still MAP, but now empty: {}
L_obj_rm — remove a node entirely¶
L_obj_set_typed obj server = MAP
L_obj_set_typed obj server host = STRING "localhost"
L_obj_rm obj server host # obj.server is still MAP, but "host" is gone
L_obj_rm obj server # obj has no "server" key at all
Iterating over keys¶
L_obj_keys -v keys obj
for key in "${keys[@]}"; do
L_obj_get -v value obj "$key"
echo "$key: $value"
done
Checking existence and length¶
L_obj_has obj server && echo "server exists"
L_obj_len -v len obj # number of top-level keys
Converting to other formats¶
L_obj_to_json -v json_text obj
L_obj_to_toml -v toml_text obj
L_obj_to_ini -v ini_text obj
Real-world example: building an array of objects¶
The L_obj_array_append_typed -v <var> pattern is the core building block for constructing arrays of objects. This self-contained example parses a JSON array of orders, filters unpaid ones, extracts compact fields, aggregates revenue, and groups by user:
input='{"orders":[
{"id":1,"user":"anna","total":120.5,"items":["pen","book"],"paid":true},
{"id":2,"user":"piotr","total":15,"items":["pen"],"paid":false},
{"id":3,"user":"anna","total":60,"items":["lamp"],"paid":true}
]}'
L_obj_from_json ordersobj <<<"$input"
# Filter unpaid orders into a new ARRAY of MAPs
L_obj_new unpaid_orders ARRAY
it=""
while L_obj_iter ordersobj it index value type position; do
L_obj_get -v paid ordersobj+${position} paid
if [[ "$paid" == false ]]; then
L_obj_array_append_typed -v elem unpaid_orders += MAP
L_obj_copy ordersobj+${position} unpaid_orders+${elem}
fi
done
# Extract only id and total
L_obj_new extractobj ARRAY
it=""
while L_obj_iter ordersobj it index value type position; do
L_obj_array_append_typed -v elem extractobj += MAP
L_obj_get -v id ordersobj+${position} id
L_obj_set extractobj+${elem} id = "$id"
L_obj_get -v total ordersobj+${position} total
L_obj_set extractobj+${elem} total = "$total"
done
# extractobj: [{"id":1,"total":120.5},{"id":2,"total":15},{"id":3,"total":60}]
# Aggregate revenue from paid orders
totalsum=0
it=""
while L_obj_iter ordersobj it index value type position; do
L_obj_get -v paid ordersobj+${position} paid
if [[ "$paid" == true ]]; then
L_obj_get -v total ordersobj+${position} total
L_float -v totalsum "$totalsum + $total"
fi
done
echo "Total revenue: $totalsum" # 180.5
# Group by user (sum totals per user)
L_obj_new usersobj MAP
it=""
while L_obj_iter ordersobj it index value type position; do
L_obj_get -v user ordersobj+${position} user
L_obj_get -v total ordersobj+${position} total
L_obj_get_or -v cur usersobj "$user" 0
L_float -v sum "$cur + $total"
L_obj_set usersobj "$user" = "$sum"
done
# usersobj: {"anna":180.5,"piotr":15}
Internal Details¶
OBJ stores a tree structure in a flat Bash array where each node occupies 6 consecutive elements: [kind, key, value, next, prev, parent].
Node fields¶
| Offset | What | Description |
|---|---|---|
| 0 | kind | One of FREE MAP ARRAY STRING INTEGER FLOAT BOOL NULL DATETIME DATE TIME |
| 1 | key | If root element, index of first FREE element. If parent is MAP, this is the key value. |
| 2 | value | For MAP/ARRAY it is the first child index. |
| 3 | next | Next sibling index (for both MAP and ARRAY children) |
| 4 | prev | Previous sibling index (for both MAP and ARRAY children) |
| 5 | parent | Pointer to parent. Empty for the root node |
"A" becomes: (
[0] STRING "" A "" "" ""
)
["a", 5] becomes: (
[0] ARRAY "" 5 "" "" ""
[5] STRING "" a 10 "" 0
[10] INTEGER "" 5 "" 5 0
)
{"a":[0,1,2,3,4,5]} becomes: (
[0] MAP "" 5 "" "" ""
[5] ARRAY a 10 "" "" 0
[10] INTEGER "" 0 15 "" 5
[15] INTEGER "" 1 20 10 5
[20] INTEGER "" 2 25 15 5
[25] INTEGER "" 3 30 20 5
[30] INTEGER "" 4 35 25 5
[35] INTEGER "" 5 "" 30 5
)
{"a":"b","c":1} becomes: (
[0] MAP "" 5 "" "" ""
[5] STRING a b 10 "" 0
[10] INTEGER c 1 "" 5 0
)
{"a":{"b":[1,"x"]},"c":null} becomes: (
[0] MAP "" 5 "" "" ""
[5] MAP a 10 25 "" 0
[10] ARRAY b 15 "" "" 5
[15] INTEGER "" 1 20 "" 10
[20] STRING "" x "" 15 10
[25] NULL c "" "" 5 0
)
With free list:
{"a":{"b":[1,"x"]},"c":null} becomes: (
[0] MAP 10 5 "" "" ""
[5] MAP a 15 35 "" 0
[10] FREE "" "" 20 "" ""
[15] ARRAY b 25 "" "" 5
[20] FREE "" "" "" "" ""
[25] INTEGER "" 1 30 "" 15
[30] STRING "" x "" 25 15
[35] NULL c "" "" 5 0
)
API Reference¶
obj
¶
obj internals [[[2
L_obj_get
¶
Options:
-
-v <var>Get value in the object. The value can't be MAP or ARRAY type. -
-v <var>
Arguments:
-
$1L_obj namereference. -
$2position -
[parts...] -
$1L_obj namereference, optionally with a position: obj or obj[12] -
[parts...]
L_obj_get_vL_RET
¶
L_obj_get_or
¶
Like L_obj_get, but if not exists, return default.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...] -
<default>
L_obj_get_or_vL_RET
¶
L_obj_get_array
¶
Alias for L_obj_values. Store values of a MAP or ARRAY into an Bash array.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]
L_obj_get_array_vL_RET
¶
L_obj_type
¶
Get type of node.
Option:
-v <var>
Arguments:
-
$1L_obj namereference -
$2position -
[parts...] -
<default>
L_obj_type_vL_RET
¶
L_obj_pos
¶
Get position of a parts path in L_obj objects.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj[12] -
[parts...]
L_obj_pos_vL_RET
¶
L_obj_value_pos
¶
Get value position inside L_obj object. You can use this index to modify or reference the value.
Example
obj=()
L_obj_set obj a b c = "Hello"
L_obj_value_pos -v pos obj a b c
echo "Hello ${obj[pos]//Hello/world}!"
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj[12] -
[parts...]
L_obj_value_pos_vL_RET
¶
L_obj_len
¶
The count of elements in an MAP or ARRAY, or the length of value for a scalar.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
Return: 1 if the path is missing.
L_obj_len_vL_RET
¶
L_obj_keys
¶
Keys of the MAP at the path (insertion order), or indices 0..n-1 for an ARRAY. Returns 1 if the path is missing or the node is a scalar.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
L_obj_keys_vL_RET
¶
L_obj_values
¶
Values of the MAP or ARRAY at the path. Returns 1 if the path is missing or the node is a scalar.
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
L_obj_values_vL_RET
¶
L_obj_items
¶
Children of a container as triples:
Option:
-v <var>
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj[12] -
[parts...]
L_obj_items_vL_RET
¶
L_obj_has
¶
Check if object has a path. Check if object has a path.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
Return: 1 if the path is missing.
L_obj_is_valid
¶
Extract L_obj name and optional +position from $1. Check that a position is a live node.
Argument:
$1
L_obj namereference, optionally with a position: obj or obj+12
Return: 0 if valid
L_obj_get_map
¶
Extract elemtns from MAP or ARRAY from L_obj as an associative array.
Option:
-v <var>
The destination associative array variable.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
L_obj_get_map_vL_ARET
¶
L_obj_set
¶
Like L_obj_set_typed, but the type is inferred from the value - FLOAT, INTEGER, STRING.
Option:
-v <var>
Assign the position of new node to var.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...] -
<=>The character = to visually sinigify end of parts and start if arguments. -
<value>The value to set to the node.
See: L_obj_set_typed
L_obj_set_vL_RET
¶
L_obj_set_typed
¶
Set scalar type and value of the node.
Option:
-v <var>
Assign the position of new node to var.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...] -
<=>The character = to visually sinigify end of parts and start of arguments. -
<type>Scalar type. For MAP and ARRAY the value is ignored. -
[value]The value of the node.
L_obj_set_typed_vL_RET
¶
L_obj_set_default
¶
Set the type and value only if node is unset. Type is inferred from default.
Option:
-v <var>
assign the position of new or existing node to var
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove. -
<=>The character = to visually sinigify end of parts and start if arguments. -
<default>The default value.
L_obj_set_default_vL_RET
¶
L_obj_set_array
¶
Set values from an bash array as an ARRAY.
Option:
-v <var>
Store the position of the node that was set.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove. -
<=>The character = to visually sinigify end of parts and start if arguments. -
[array]Optional array variable namereference.
L_obj_set_array_vL_RET
¶
L_obj_set_map
¶
Set values from an bash array as a MAP.
Option:
-v <var>
Store the position of the node that was set.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove. -
<=>The character = to visually sinigify end of parts and start if arguments. -
[array]Optional associative or normal array variable namereference.
L_obj_set_map_vL_RET
¶
L_obj_retype
¶
Change the type of a scalar value. Not possible to call on MAP or ARRAY.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove. -
<=>The character = to visually sinigify end of parts and start if arguments. -
<type>
L_obj_rm
¶
Remove the node at a position, or at a path below it, and free its subtree.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove.
Return: 1 if the path doesn't exist.
L_obj_new
¶
Sets the object to an empty array to a type and value.
Arguments:
-
$1L_obj namereference -
[$2]Optional root type, can be MAP or ARRAY. -
[$3]Optional value for scalar type.
L_obj_clear
¶
Clear the children of a MAP or ARRAY, preserving the container itself.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...]The path to remove.
L_obj_string_append
¶
Append to the value of a node. Node cannot be MAP or ARRAY. If it is not a STRING, it will be set to STRING.
Arguments:
-
$1L_obj namereference, optionally with a position: obj+12 -
[parts...] -
<+=> -
value
Return: 1 if the path is missing.
L_obj_path
¶
Path of a node: the inverse of L_obj_pos. Climbs the parent links from the node to the root. The parts are MAP keys, or ARRAY indexes counted from 0. The root has an empty path. Finding an ARRAY index walks the previous siblings, so it is O(n) per ARRAY level. Use -v: without it the parts are printed one per line, which breaks on keys with newlines.
Example
L_obj_pos -v pos obj a b 0
L_obj_path -v parts "obj+$pos" c d 1 # parts=(a b 0 c d 1)
L_obj_get obj "${parts[@]}" # round-trips to the same node
Option:
-v <var>
Store the parts in an indexed array.
Arguments:
-
$1L_obj namereference with a position: obj+12. Without a position, the root. -
[parts...]
Return: 1 if the position is not a live node.
L_obj_path_vL_RET
¶
L_obj_array_append
¶
Like _L_obj_array_append_type_value but infer type of value.
Option:
-v <var>
Store the position of the new element.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...] -
<+=> -
<value>
See: _L_obj_array_append_type_value
L_obj_array_append_vL_RET
¶
L_obj_array_append_typed
¶
Append value with type to an array.
Option:
-v <var>
Store the position of the new element.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...] -
<+=> -
<type> -
[value]
L_obj_array_append_typed_vL_RET
¶
L_obj_array_insert
¶
Like L_obj_array_insert_typed, but the type is inferred from the value - FLOAT, INTEGER, STRING.
Options:
-
-v <var>Store the position of the new element. -
-v <var>position of the new node
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]Path parts to the ARRAY container -
$indexindex (0-based, must be <= current length) -
<=>The character = to visually signify end of index and start of arguments. -
<value>The value to set to the node.
Return: 1 if index out of bounds or container is not ARRAY.
L_obj_array_insert_vL_RET
¶
L_obj_array_insert_typed
¶
Insert a new element into an ARRAY at index. Shifts existing elements right.
Option:
-v <var>
Store the position of the new element.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]Path parts to the ARRAY container -
$indexindex (0-based, must be <= current length) -
<=>The character = to visually signify end of index and start of arguments. -
<type>The type of the value. If type is MAP or ARRAY, the value is ignored. -
<value>The value of the node.
Return: 1 if index out of bounds or container is not ARRAY.
L_obj_array_insert_typed_vL_RET
¶
L_obj_array_shift
¶
Remove the first element of an ARRAY and return its scalar value.
Option:
-v <var>
If the popped node is scalar, store the popped value in var. Otherwise will store empty.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]Path to the ARRAY
Return: 1 if the path is missing, not an ARRAY, empty, or the first element is a container.
L_obj_array_shift_vL_RET
¶
L_obj_array_pop
¶
Remove the last element of the ARRAY at the path and return its scalar value.
Option:
-v <var>
If the popped node is scalar, store the popped value in var. Otherwise will store empty.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]
Return: 1 if the path is missing, not an ARRAY, empty, or the last element is a container.
L_obj_array_pop_vL_RET
¶
L_obj_array_extend
¶
Append all elements of a bash array to an ARRAY. Types are inferred per element. A missing path is created as an ARRAY. An empty bash array is a no-op.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
[parts...]Path to the ARRAY -
<+=>The characters += to visually signify end of parts and start of arguments. -
<array>Name of a bash indexed array.
Return: 1 if the node is not an ARRAY.
L_obj_set_obj
¶
Set a path to a deep copy of another object. Same as L_obj_copy, with the destination first.
Option:
-v <var>
Store the position of the destination node.
Arguments:
-
$1destination L_obj, optionally with position: obj or obj+12 -
[parts...]destination path -
<=>The character = to visually signify end of parts and start of arguments. -
<src>source L_obj, optionally with position: obj or obj+12
L_obj_set_obj_vL_RET
¶
L_obj_copy
¶
Deep copy a subtree. The destination node's old children are removed and replaced.
Option:
-v <var>
Store the position of the newly created node.
Arguments:
-
$1source L_obj, optionally with position: obj or obj+12 -
$2destination L_obj, optionally with position: obj or obj+12 -
[parts...]destination L_obj parts
L_obj_copy_vL_RET
¶
L_obj_merge
¶
Deep merge src into dst. MAPs merge key by key, everything else (scalars, ARRAYs, type mismatches) is replaced by a copy of the src node.
Arguments:
-
$1source L_obj, optionally with position: obj or obj+12 -
$2destination L_obj, optionally with position: obj or obj+12
L_obj_cmp
¶
Arguments:
-
$1first object name, optionally with position: obj or obj+12 -
$2second object name, optionally with position: obj or obj+12
Return: 0 if equal, 1 if different
L_obj_foreach
¶
Call a callback for each direct child of a container. The next node is read before the callback runs, so the callback may L_obj_rm the current child.
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
<cb...>called as: cb...
value is empty for MAP and ARRAY, pos is the child position.
Return: 0 done, 1 not a container, or the nonzero return of the callback
L_obj_iter
¶
Cursor over the direct children of a container. Same fields as L_obj_foreach. Set the iterator to empty before the loop. It holds "next:index" while looping and is emptied at the end. After a break, reset it before reuse. Removing the current child inside the loop is safe.
Example
it=; while L_obj_iter obj it k v t pos; do echo "$k=$v"; done
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
$2iterator variable, empty to start -
$3variable for the key (MAP) or index (ARRAY) -
[$4]variable for the value -
[$5]variable for the type -
[$6]variable for the child position
Return: 0 got a child, 1 end or not a container
L_obj_walk
¶
Walks the L_obj recursively and calls the callback with the following arguments:
cb... START <type> -- <parts...> for type: MAP|ARRAY
cb... VALUE <type> <value> <parts...> for other types
cb... END <type> -- <parts...>
Parts exclude the root. A nonzero callback return aborts the walk and is returned.
Options:
-
-Ssort keys -
-hprint this help and return 0
Arguments:
-
$1L_obj namereference, optionally with a position: obj or obj+12 -
<cb...>Callback with arguments to call.
L_obj_from_json
¶
Convert a json into an object.
Arguments:
-
<object> -
<offset...>
L_obj_to_json
¶
Convert obj into json.
Options:
-
-aUse only ascii characters escapes in strings. -
-cCompact output. -
-i <int>Indent count of spaces. -
-CColor output. -
-SSort keys. -
-v <var>Store the output in variable instead of printing it. -
-hPrint this help and return 0.
Argument:
$1
JSON
L_obj_from_ini
¶
Convert ini to L_obj
Argument:
$1
L_obj namerefrence
L_obj_to_ini
¶
Serializes OBJ to INI text.
Options:
-
-Ssort keys -
-v <var>Store into varaible instead of printing. -
-h
Argument:
$1
L_obj namereference.
L_obj_from_toml
¶
Parse TOML into an L_obj.
Argument:
$1
obj variable name
L_obj_to_toml
¶
Convert obj into toml.
Options:
-
-Ssort keys -
-v <var>Store output in variable. -
-hPrint this help and return 0.
Argument:
obj