-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexey Gladkov <[email protected]>
- Loading branch information
Showing
48 changed files
with
1,607 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
shell-json(3) | ||
|
||
# NAME | ||
|
||
json_foreach - function for streaming json parsing | ||
|
||
# SYNOPSIS | ||
|
||
- json_foreach | ||
- json_foreach_handler type value | ||
- json_get_last_name retvar | ||
- json_get_full_name retvar [separator] | ||
|
||
# DESCRIPTION | ||
|
||
## json_foreach | ||
The function consumes standard input to parse JSON and calls `json_foreach_handler` for each | ||
simple value (`string`, `number`, `boolean` and `null`). | ||
|
||
## json_foreach_handler | ||
The function is a callback that is called for each JSON value. The function | ||
receives the value type and the JSON value of the variable as arguments. Inside | ||
the callback, you can get the field name by calling the `json_get_last_name` | ||
or `json_get_full_name`. | ||
|
||
## json_get_last_name | ||
This is a helper that is meant to be called from the `json_foreach_handler`. It | ||
puts into the `retvar` with the name of JSON field. | ||
|
||
## json_get_full_name | ||
Same as `json_get_last_name` but returns full JSON field name. The name is made | ||
up of the parent names of the fields joined with a `separator`. | ||
|
||
# AUTHOR | ||
Authors and contributors of the programs included in the *libshell* package are listed | ||
in the COPYING file. | ||
|
||
# BUGS | ||
Report bugs to the authors. | ||
|
Oops, something went wrong.