This module provides a low-level interface for manipulation of JSON data. The two public entities are json_value, and json_core. The json_file_module provides a higher-level interface to some of these routines.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(kind=CDK,len=*), | private, | parameter | :: | access_spec | = | 'STREAM' | If Unicode is not enabled, then JSON files are opened using access='STREAM' and form='UNFORMATTED'. This allows the file to be read faster. |
character(kind=CDK,len=*), | private, | parameter | :: | form_spec | = | 'UNFORMATTED' | If Unicode is not enabled, then JSON files are opened using access='STREAM' and form='UNFORMATTED'. This allows the file to be read faster. |
logical, | private, | parameter | :: | use_unformatted_stream | = | .true. | If Unicode is not enabled, then JSON files are opened using access='STREAM' and form='UNFORMATTED'. This allows the file to be read faster. |
Structure constructor to initialize a json_core object
Function constructor for a json_core. This is just a wrapper for json_initialize.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical(kind=LK), | intent(in), | optional | :: | verbose | mainly useful for debugging (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | compact_reals | to compact the real number strings for output (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | print_signs | always print numeric sign (default is false) |
|
character(kind=CDK,len=*), | intent(in), | optional | :: | real_format | Real number format: 'E' [default], '*', 'G', 'EN', or 'ES' |
|
integer(kind=IK), | intent(in), | optional | :: | spaces_per_tab | number of spaces per tab for indenting (default is 2) |
|
logical(kind=LK), | intent(in), | optional | :: | strict_type_checking | if true, no integer, double, or logical type
conversions are done for the |
|
logical(kind=LK), | intent(in), | optional | :: | trailing_spaces_significant | for name and path comparisons, is trailing space to be considered significant. (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | case_sensitive_keys | for name and path comparisons, are they case sensitive. (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | no_whitespace | if true, printing the JSON structure is done without adding any non-significant spaces or linebreaks (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | unescape_strings | If false, then the raw escaped string is returned from json_get_string and similar routines. If true [default], then the string is returned unescaped. |
|
character(kind=CK,len=1), | intent(in), | optional | :: | comment_char | If present, this character is used
to denote comments in the JSON file,
which will be ignored if present.
Example: |
|
integer(kind=IK), | intent(in), | optional | :: | path_mode | How the path strings are interpreted in the
|
|
character(kind=CK,len=1), | intent(in), | optional | :: | path_separator | The |
|
logical(kind=LK), | intent(in), | optional | :: | compress_vectors | If true, then arrays of integers,
nulls, doubles, and logicals are
printed all on one line.
[Note: |
|
logical(kind=LK), | intent(in), | optional | :: | allow_duplicate_keys | ||
logical(kind=LK), | intent(in), | optional | :: | escape_solidus | ||
logical(kind=LK), | intent(in), | optional | :: | stop_on_error | If an exception is raised, then immediately quit. (Default is False). |
Array element callback function. Used by json_get_array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | element | ||
integer(kind=IK), | intent(in) | :: | i | index |
||
integer(kind=IK), | intent(in) | :: | count | size of array |
Callback function used by json_traverse
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
logical(kind=LK), | intent(out) | :: | finished | set true to stop traversing |
To access the core routines for manipulation of json_value pointer variables. This class allows for thread safe use of the module.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical(kind=LK), | private | :: | allow_comments | = | .true. | if true, any comments will be ignored when
parsing a file. The comment token is defined
by the |
|
logical(kind=LK), | private | :: | allow_duplicate_keys | = | .true. | If False, then after parsing, if any duplicate keys are found, an error is thrown. A call to json_value_validate will also check for duplicates. If True [default] then no special checks are done |
|
logical(kind=LK), | private | :: | case_sensitive_keys | = | .true. | if name and path comparisons are case sensitive. |
|
integer(kind=IK), | private | :: | char_count | = | 0 | character position in the current line |
|
character(kind=CK,len=1), | private | :: | comment_char | = | CK_'!' | comment token when
|
|
logical(kind=LK), | private | :: | compact_real | = | .true. | to use the "compact" form of real numbers for output |
|
logical(kind=LK), | private | :: | compress_vectors | = | .false. | If true, then arrays of integers,
nulls, doubles, & logicals are
printed all on one line.
[Note: |
|
character(kind=CK,len=:), | private, | allocatable | :: | err_message | the error message |
||
logical(kind=LK), | private | :: | escape_solidus | = | .false. | If True then the solidus " |
|
logical(kind=LK), | private | :: | exception_thrown | = | .false. | The error flag. Will be set to true when an error is thrown in the class. Many of the methods will check this and return immediately if it is true. |
|
integer(kind=IK), | private | :: | ipos | = | 1 | for allocatable strings: next character to read |
|
logical(kind=LK), | private | :: | is_verbose | = | .false. | if true, all exceptions are immediately printed to console. |
|
integer(kind=IK), | private | :: | line_count | = | 1 | lines read counter |
|
logical(kind=LK), | private | :: | no_whitespace | = | .false. | when printing a JSON string, don't include non-significant spaces or line breaks. If true, the entire structure will be printed on one line. |
|
integer(kind=IK), | private | :: | path_mode | = | 1_IK | How the path strings are interpreted in the
|
|
character(kind=CK,len=1), | private | :: | path_separator | = | dot | The |
|
character(kind=CK,len=pushed_char_size), | private | :: | pushed_char | = | CK_'' | used when parsing lines in file |
|
integer(kind=IK), | private | :: | pushed_index | = | 0 | used when parsing lines in file |
|
character(kind=CDK,len=:), | private, | allocatable | :: | real_fmt | the format string to use
for converting real numbers to strings.
It can be set in json_initialize,
and used in json_value_print
If not set, then |
||
integer(kind=IK), | private | :: | spaces_per_tab | = | 2 | number of spaces for indenting |
|
logical(kind=LK), | private | :: | stop_on_error | = | .false. | if true, then the program is stopped immediately when an exception is raised. |
|
logical(kind=LK), | private | :: | strict_type_checking | = | .false. | if true, then no type conversions are done
in the |
|
logical(kind=LK), | private | :: | trailing_spaces_significant | = | .false. | for name and path comparisons, if trailing space is to be considered significant. |
|
logical(kind=LK), | private | :: | unescaped_strings | = | .true. | If false, then the escaped string is returned from json_get_string and similar routines. If true [default], then the string is returned unescaped. |
Structure constructor to initialize a json_core object
private function initialize_json_core(verbose, compact_reals, print_signs, real_format, spaces_per_tab, strict_type_checking, trailing_spaces_significant, case_sensitive_keys, no_whitespace, unescape_strings, comment_char, path_mode, path_separator, compress_vectors, allow_duplicate_keys, escape_solidus, stop_on_error) | Function constructor for a json_core. This is just a wrapper for json_initialize. |
generic, public :: add => json_value_add_member, json_value_add_null, json_value_add_integer, json_value_add_integer_vec, json_value_add_double, json_value_add_double_vec, json_value_add_logical, json_value_add_logical_vec, json_value_add_string, json_value_add_string_vec | Add objects to a linked list of json_values. |
generic, public :: add_by_path => json_add_member_by_path, json_add_integer_by_path, json_add_double_by_path, json_add_logical_by_path, json_add_string_by_path, json_add_integer_vec_by_path, json_add_double_vec_by_path, json_add_logical_vec_by_path, json_add_string_vec_by_path | Add variables to a json_value linked list by specifying their paths. |
procedure, private :: annotate_invalid_json | |
procedure, public :: check_children_for_duplicate_keys => json_check_children_for_duplicate_keys | Check a |
procedure, public :: check_for_duplicate_keys => json_check_all_for_duplicate_keys | Check entire JSON structure for duplicate keys (recursively) |
procedure, public :: check_for_errors => json_check_for_errors | check for error and get error message |
procedure, public :: clear_exceptions => json_clear_exceptions | clear exceptions |
procedure, public :: clone => json_clone | clone a JSON structure (deep copy) |
procedure, private :: convert | |
procedure, public :: count => json_count | count the number of children |
generic, public :: create => json_create_by_path | Create a json_value linked list using the path to the variables. Optionally return a pointer to the variable. |
generic, public :: create_array => json_value_create_array | Allocate a json_value pointer and make it an array variable. The pointer should not already be allocated. |
generic, public :: create_double => json_value_create_double | Allocate a json_value pointer and make it a double variable. The pointer should not already be allocated. |
generic, public :: create_integer => json_value_create_integer | Allocate a json_value pointer and make it an integer variable. The pointer should not already be allocated. |
generic, public :: create_logical => json_value_create_logical | Allocate a json_value pointer and make it a logical variable. The pointer should not already be allocated. |
generic, public :: create_null => json_value_create_null | Allocate a json_value pointer and make it a null variable. The pointer should not already be allocated. |
generic, public :: create_object => json_value_create_object | Allocate a json_value pointer and make it an object variable. The pointer should not already be allocated. |
generic, public :: create_string => json_value_create_string | Allocate a json_value pointer and make it a string variable. The pointer should not already be allocated. |
generic, public :: destroy => json_value_destroy, destroy_json_core | Destructor routine for a json_value pointer. This must be called explicitly if it is no longer needed, before it goes out of scope. Otherwise, a memory leak will result. |
procedure, private :: destroy_json_core | |
procedure, public :: failed => json_failed | check for error |
generic, public :: get => json_get_by_path, json_get_integer, json_get_integer_by_path, json_get_integer_vec, json_get_integer_vec_by_path, json_get_double, json_get_double_by_path, json_get_double_vec, json_get_double_vec_by_path, json_get_logical, json_get_logical_by_path, json_get_logical_vec, json_get_logical_vec_by_path, json_get_string, json_get_string_by_path, json_get_string_vec, json_get_string_vec_by_path, json_get_alloc_string_vec, json_get_alloc_string_vec_by_path, json_get_array, json_get_array_by_path | Get data from a json_value linked list. |
generic, public :: get_child => json_value_get_child_by_index, json_value_get_child, json_value_get_child_by_name | Return a child of a json_value structure. |
procedure, private :: get_current_line_from_file_sequential | |
procedure, private :: get_current_line_from_file_stream | |
procedure, public :: get_next => json_get_next | get pointer to json_value next |
procedure, public :: get_parent => json_get_parent | get pointer to json_value parent |
generic, public :: get_path => json_get_path | get the path to a JSON variable in a structure: |
procedure, public :: get_previous => json_get_previous | get pointer to json_value previous |
procedure, public :: get_tail => json_get_tail | get pointer to json_value tail |
generic, public :: info => json_info, json_info_by_path | get info about a json_value |
procedure, public :: initialize => json_initialize | to initialize some parsing parameters |
generic, public :: insert_after => json_value_insert_after, json_value_insert_after_child_by_index | insert a new element after an existing one, updating the JSON structure accordingly |
procedure, public :: is_child_of => json_value_is_child_of | Check if a json_value is a descendant of another. |
procedure, private :: json_add_double_by_path | |
procedure, private :: json_add_double_vec_by_path | |
procedure, private :: json_add_integer_by_path | |
procedure, private :: json_add_integer_vec_by_path | |
procedure, private :: json_add_logical_by_path | |
procedure, private :: json_add_logical_vec_by_path | |
procedure, private :: json_add_member_by_path | |
procedure, private :: json_add_string_by_path | |
procedure, private :: json_add_string_vec_by_path | |
procedure, private :: json_create_by_path | |
procedure, private :: json_get_alloc_string_vec | |
procedure, private :: json_get_alloc_string_vec_by_path | |
procedure, private :: json_get_array | |
procedure, private :: json_get_array_by_path | |
procedure, private :: json_get_by_path | |
procedure, private :: json_get_by_path_default | |
procedure, private :: json_get_by_path_jsonpath_bracket | |
procedure, private :: json_get_by_path_rfc6901 | |
procedure, private :: json_get_double | |
procedure, private :: json_get_double_by_path | |
procedure, private :: json_get_double_vec | |
procedure, private :: json_get_double_vec_by_path | |
procedure, private :: json_get_integer | |
procedure, private :: json_get_integer_by_path | |
procedure, private :: json_get_integer_vec | |
procedure, private :: json_get_integer_vec_by_path | |
procedure, private :: json_get_logical | |
procedure, private :: json_get_logical_by_path | |
procedure, private :: json_get_logical_vec | |
procedure, private :: json_get_logical_vec_by_path | |
procedure, private :: json_get_path | |
procedure, private :: json_get_string | |
procedure, private :: json_get_string_by_path | |
procedure, private :: json_get_string_vec | |
procedure, private :: json_get_string_vec_by_path | |
procedure, private :: json_info | |
procedure, private :: json_info_by_path | |
procedure, private :: json_matrix_info | |
procedure, private :: json_matrix_info_by_path | |
procedure, private :: json_parse_file | |
procedure, private :: json_parse_string | |
procedure, private :: json_print_1 | |
procedure, private :: json_print_2 | |
procedure, private :: json_rename_by_path | |
procedure, private :: json_string_info | |
procedure, private :: json_throw_exception | |
procedure, private :: json_update_double | |
procedure, private :: json_update_integer | |
procedure, private :: json_update_logical | |
procedure, private :: json_update_string | |
procedure, private :: json_valid_path | |
procedure, private :: json_value_add_double | |
procedure, private :: json_value_add_double_vec | |
procedure, private :: json_value_add_integer | |
procedure, private :: json_value_add_integer_vec | |
procedure, private :: json_value_add_logical | |
procedure, private :: json_value_add_logical_vec | |
procedure, private :: json_value_add_member | |
procedure, private :: json_value_add_null | |
procedure, private :: json_value_add_string | |
procedure, private :: json_value_add_string_vec | |
procedure, private :: json_value_create_array | |
procedure, private :: json_value_create_double | |
procedure, private :: json_value_create_integer | |
procedure, private :: json_value_create_logical | |
procedure, private :: json_value_create_null | |
procedure, private :: json_value_create_object | |
procedure, private :: json_value_create_string | |
procedure, private :: json_value_destroy | |
procedure, private :: json_value_get_child | |
procedure, private :: json_value_get_child_by_index | |
procedure, private :: json_value_get_child_by_name | |
procedure, private :: json_value_insert_after | |
procedure, private :: json_value_insert_after_child_by_index | |
procedure, private :: json_value_print | |
procedure, private :: json_value_remove_if_present | |
procedure, private :: json_value_rename | |
generic, public :: matrix_info => json_matrix_info, json_matrix_info_by_path | get matrix info about a json_value |
procedure, private :: name_equal | |
procedure, private :: name_strings_equal | |
generic, public :: parse => json_parse_file, json_parse_string | Parse the JSON file and populate the json_value tree. |
procedure, private :: parse_array | |
procedure, private :: parse_for_chars | |
procedure, private :: parse_number | |
procedure, private :: parse_object | |
procedure, private :: parse_string | |
procedure, private :: parse_value | |
procedure, private :: pop_char | |
generic, public :: print => json_print_1, json_print_2 | Print the json_value to a file. |
procedure, public :: print_error_message => json_print_error_message | simply routine to print error messages |
procedure, public :: print_to_string => json_value_to_string | Print the json_value structure to an allocatable string |
procedure, private :: push_char | |
procedure, public :: remove => json_value_remove | Remove a json_value from a linked-list structure. |
generic, public :: remove_if_present => json_value_remove_if_present | If the child variable is present, then remove it. |
generic, public :: rename => json_value_rename, json_rename_by_path | Rename a json_value variable. |
procedure, public :: replace => json_value_replace | Replace a json_value in a linked-list structure. |
procedure, public :: reverse => json_value_reverse | Reverse the order of the children of an array of object. |
generic, public :: string_info => json_string_info | get string info about a json_value |
procedure, private :: string_to_dble | |
procedure, private :: string_to_int | |
procedure, public :: swap => json_value_swap | Swap two json_value pointers in a structure (or two different structures). |
generic, public :: throw_exception => json_throw_exception | Throw an exception. |
procedure, private :: to_array | |
procedure, private :: to_double | |
procedure, private :: to_integer | |
procedure, private :: to_logical | |
procedure, private :: to_null | |
procedure, private :: to_object | |
procedure, private :: to_string | |
procedure, public :: traverse => json_traverse | to traverse all elements of a JSON structure |
generic, public :: update => json_update_logical, json_update_double, json_update_integer, json_update_string | These are like the |
generic, public :: valid_path => json_valid_path | verify if a path is valid (i.e., a variable with this path exists in the file). |
procedure, public :: validate => json_value_validate | Check that a json_value linked list is valid (i.e., is properly constructed). This may be useful if it has been constructed externally. |
Type used to construct the linked-list JSON structure. Normally, this should always be a pointer variable. This type should only be used by an instance of json_core.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(json_value), | private, | pointer | :: | children | => | null() | first child item of this |
real(kind=RK), | private, | allocatable | :: | dbl_value | real data for this variable |
||
integer(kind=IK), | private, | allocatable | :: | int_value | integer data for this variable |
||
logical(kind=LK), | private, | allocatable | :: | log_value | logical data for this variable |
||
integer(kind=IK), | private | :: | n_children | = | 0 | number of children |
|
character(kind=CK,len=:), | private, | allocatable | :: | name | variable name (unescaped) |
||
type(json_value), | private, | pointer | :: | next | => | null() | next item in the list |
type(json_value), | private, | pointer | :: | parent | => | null() | parent item of this |
type(json_value), | private, | pointer | :: | previous | => | null() | previous item in the list |
character(kind=CK,len=:), | private, | allocatable | :: | str_value | string data for this variable (unescaped) |
||
type(json_value), | private, | pointer | :: | tail | => | null() | last child item of this |
integer(kind=IK), | private | :: | var_type | = | json_unknown | variable type |
Function constructor for a json_core. This is just a wrapper for json_initialize.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical(kind=LK), | intent(in), | optional | :: | verbose | mainly useful for debugging (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | compact_reals | to compact the real number strings for output (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | print_signs | always print numeric sign (default is false) |
|
character(kind=CDK,len=*), | intent(in), | optional | :: | real_format | Real number format: 'E' [default], '*', 'G', 'EN', or 'ES' |
|
integer(kind=IK), | intent(in), | optional | :: | spaces_per_tab | number of spaces per tab for indenting (default is 2) |
|
logical(kind=LK), | intent(in), | optional | :: | strict_type_checking | if true, no integer, double, or logical type
conversions are done for the |
|
logical(kind=LK), | intent(in), | optional | :: | trailing_spaces_significant | for name and path comparisons, is trailing space to be considered significant. (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | case_sensitive_keys | for name and path comparisons, are they case sensitive. (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | no_whitespace | if true, printing the JSON structure is done without adding any non-significant spaces or linebreaks (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | unescape_strings | If false, then the raw escaped string is returned from json_get_string and similar routines. If true [default], then the string is returned unescaped. |
|
character(kind=CK,len=1), | intent(in), | optional | :: | comment_char | If present, this character is used
to denote comments in the JSON file,
which will be ignored if present.
Example: |
|
integer(kind=IK), | intent(in), | optional | :: | path_mode | How the path strings are interpreted in the
|
|
character(kind=CK,len=1), | intent(in), | optional | :: | path_separator | The |
|
logical(kind=LK), | intent(in), | optional | :: | compress_vectors | If true, then arrays of integers,
nulls, doubles, and logicals are
printed all on one line.
[Note: |
|
logical(kind=LK), | intent(in), | optional | :: | allow_duplicate_keys | ||
logical(kind=LK), | intent(in), | optional | :: | escape_solidus | ||
logical(kind=LK), | intent(in), | optional | :: | stop_on_error | If an exception is raised, then immediately quit. (Default is False). |
Count the number of children.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p |
number of children
Returns true if the path
is present in the p
JSON structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
true if it was found
Returns True if p2
is a descendant of p1
(i.e, a child, or a child of child, etc.)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p1 | |||
type(json_value), | pointer | :: | p2 |
Returns true if name
is equal to p%name
, using the specified
settings for case sensitivity and trailing whitespace.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in) | :: | p | the json object |
||
character(kind=CK,len=*), | intent(in) | :: | name | the name to check for |
true if the string are lexically equal
Returns true if the name strings name1
is equal to name2
, using
the specified settings for case sensitivity and trailing whitespace.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=*), | intent(in) | :: | name1 | the name to check |
||
character(kind=CK,len=*), | intent(in) | :: | name2 | the name to check |
true if the string are lexically equal
Convert a string into a double.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=*), | intent(in) | :: | str |
Convert a string into an integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=*), | intent(in) | :: | str |
Alternate version of json_valid_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list |
|
character(kind=CDK,len=*), | intent(in) | :: | path | path to the variable |
true if it was found
Generate a warning message if there was an error parsing a JSON file or string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | iunit | file unit number |
||
character(kind=CK,len=*), | intent(in) | :: | str | string with JSON data |
Convert an existing JSON variable p
to a different variable type.
The existing variable (and its children) is destroyed. It is replaced
in the structure by a new variable of type var_type
(which can be a json_null
, json_object
or json_array
).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | the variable to convert |
||
integer(kind=IK), | intent(in) | :: | var_type | the variable type to convert |
Destroy the data within a json_value, and reset type to json_unknown
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | d |
Rewind the file to the beginning of the current line, and return this line. The file is assumed to be opened. This is the SEQUENTIAL version (see also get_current_line_from_file_stream).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | iunit | file unit number |
||
character(kind=CK,len=:), | intent(out), | allocatable | :: | line | current line |
Rewind the file to the beginning of the current line, and return this line. The file is assumed to be opened. This is the STREAM version (see also get_current_line_from_file_sequential).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | iunit | file unit number |
||
character(kind=CK,len=:), | intent(out), | allocatable | :: | line | current line |
Add an double value to a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
real(kind=RK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_double_by_path for adding a double vector by path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
real(kind=RK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Add an integer value to a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
integer(kind=IK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_integer_by_path for adding an integer vector by path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
integer(kind=IK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Add a logical value to a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
logical(kind=LK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_logical_by_path for adding a logical vector by path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
logical(kind=LK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Add a new member (json_value
pointer) to a JSON structure, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
type(json_value), | intent(in), | pointer | :: | p | the value to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Add a string value to a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CK,len=*), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper for json_add_string_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CK,len=*), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper for json_add_string_by_path where "value" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CDK,len=*), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper to json_add_string_by_path for adding a string vector by path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CK,len=*), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
integer(kind=IK), | intent(in), | optional | dimension(:) | :: | ilen | the string lengths of each
element in |
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper for json_add_string_vec_by_path where "path" is kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CK,len=*), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
integer(kind=IK), | intent(in), | optional | dimension(:) | :: | ilen | the string lengths of each
element in |
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper for json_add_string_vec_by_path where "value" is kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CDK,len=*), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
integer(kind=IK), | intent(in), | optional | dimension(:) | :: | ilen | the string lengths of each
element in |
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Checks a JSON structure for duplicate child names. This one recursively traverses the entire structure (calling json_check_children_for_duplicate_keys recursively for each element).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | the object to search. If |
|
logical(kind=LK), | intent(out) | :: | has_duplicate | true if there is at least
one duplicate |
||
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | the duplicate name (unallocated if no duplicates were found) |
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | path | the full path to the duplicate name (unallocated if no duplicate was found) |
Checks a JSON object for duplicate child names.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | the object to search. If |
|
logical(kind=LK), | intent(out) | :: | has_duplicate | true if there is at least
two children have duplicate
|
||
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | the duplicate name (unallocated if no duplicate was found) |
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | path | the full path to the duplicate name (unallocated if no duplicate was found) |
Retrieve error code from the json_core.
This should be called after parse
to check for errors.
If an error is thrown, before using the class again, json_initialize
should be called to clean up before it is used again.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
logical(kind=LK), | intent(out) | :: | status_ok | true if there were no errors |
||
character(kind=CK,len=:), | intent(out), | allocatable | :: | error_msg | the error message (if there were errors) |
Create a deep copy of a json_value linked-list structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | from | this is the structure to clone |
||
type(json_value), | pointer | :: | to | the clone is put here (it must not already be associated) |
Returns the json_value pointer given the path string, If necessary, by creating the variables as needed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
||
type(json_value), | intent(out), | optional | pointer | :: | p | pointer to the variable
specify by |
logical(kind=LK), | intent(out), | optional | :: | found | true if there were no errors (variable found or created) |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | true if it was actually created (as opposed to already being there) |
Get a string vector from a json_value. This is an alternate version of json_get_string_vec. This one returns an allocatable length character (where the string length is the maximum length of any element in the array). It also returns an integer array of the actual sizes of the strings in the JSON structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=:), | intent(out), | dimension(:), allocatable | :: | vec | ||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | ilen | the actual length of each character string in the array |
Alternate version of json_get_alloc_string_vec where input is the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=:), | intent(out), | dimension(:), allocatable | :: | vec | ||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | ilen | the actual length of each character string in the array |
|
logical(kind=LK), | intent(out), | optional | :: | found |
This routine calls the user-supplied json_array_callback_func subroutine for each element in the array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
procedure(json_array_callback_func) | :: | array_callback |
This routine calls the user-supplied array_callback subroutine for each element in the array (specified by the path).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
procedure(json_array_callback_func) | :: | array_callback | ||||
logical(kind=LK), | intent(out), | optional | :: | found |
Returns the json_value pointer given the path string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
||
type(json_value), | intent(out), | pointer | :: | p | pointer to the variable
specified by |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
Returns the json_value pointer given the path string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
||
type(json_value), | intent(out), | pointer | :: | p | pointer to the variable
specify by |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
logical(kind=LK), | intent(in), | optional | :: | create_it | if a variable is not present
in the path, then it is created.
the leaf node is returned as
a |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if |
Returns the json_value pointer given the path string, using the "JSON Pointer" path specification defined by the JSONPath "bracket-notation".
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable (using JSONPath "bracket-notation") |
||
type(json_value), | intent(out), | pointer | :: | p | pointer to the variable
specify by |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
logical(kind=LK), | intent(in), | optional | :: | create_it | if a variable is not present
in the path, then it is created.
the leaf node is returned as
a |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if |
Returns the json_value pointer given the path string, using the "JSON Pointer" path specification defined by RFC 6901.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable (an RFC 6901 "JSON Pointer") |
||
type(json_value), | intent(out), | pointer | :: | p | pointer to the variable
specify by |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
Get a double value from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
real(kind=RK), | intent(out) | :: | value |
Get a double value from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Get a double vector from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
real(kind=RK), | intent(out), | dimension(:), allocatable | :: | vec |
Get a double vector from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Get an integer value from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
integer(kind=IK), | intent(out) | :: | value |
Get an integer value from a json_value, given the path string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Get an integer vector from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | vec |
Get an integer vector from a json_value, given the path string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Get a logical value from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
logical(kind=LK), | intent(out) | :: | value |
Get a logical value from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Get a logical vector from json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
logical(kind=LK), | intent(out), | dimension(:), allocatable | :: | vec |
Get a logical vector from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Returns a pointer to the next of a json_value.
If there is no next, then a null()
pointer is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | JSON object |
|
type(json_value), | intent(out), | pointer | :: | next | pointer to |
Returns a pointer to the parent of a json_value.
If there is no parent, then a null()
pointer is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | JSON object |
|
type(json_value), | intent(out), | pointer | :: | parent | pointer to |
Returns the path to a JSON object that is part of a linked list structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list object |
|
character(kind=CK,len=:), | intent(out), | allocatable | :: | path | path to the variable |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if there were no problems |
|
logical(kind=LK), | intent(in), | optional | :: | use_alt_array_tokens | if true, then '()' are used for array elements
otherwise, '[]' are used [default]
(only used if |
|
character(kind=CK,len=1), | intent(in), | optional | :: | path_sep | character to use for path separator
(otherwise use |
Returns a pointer to the previous of a json_value.
If there is no previous, then a null()
pointer is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | JSON object |
|
type(json_value), | intent(out), | pointer | :: | previous | pointer to |
Get a character string from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=:), | intent(out), | allocatable | :: | value |
Get a character string from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=:), | intent(out), | allocatable | :: | value | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Get a string vector from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(out), | dimension(:), allocatable | :: | vec |
Get a string vector from a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Returns a pointer to the tail of a json_value
(the last child of an array of object).
If there is no tail, then a null()
pointer is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | JSON object |
|
type(json_value), | intent(out), | pointer | :: | tail | pointer to |
Returns information about a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type |
|
integer(kind=IK), | intent(out), | optional | :: | n_children | number of children |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list |
|
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type |
|
integer(kind=IK), | intent(out), | optional | :: | n_children | number of children |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Initialize the json_core instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | me | |||
logical(kind=LK), | intent(in), | optional | :: | verbose | mainly useful for debugging (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | compact_reals | to compact the real number strings for output (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | print_signs | always print numeric sign (default is false) |
|
character(kind=CDK,len=*), | intent(in), | optional | :: | real_format | Real number format: 'E' [default], '*', 'G', 'EN', or 'ES' |
|
integer(kind=IK), | intent(in), | optional | :: | spaces_per_tab | number of spaces per tab for indenting (default is 2) |
|
logical(kind=LK), | intent(in), | optional | :: | strict_type_checking | if true, no integer, double, or logical type
conversions are done for the |
|
logical(kind=LK), | intent(in), | optional | :: | trailing_spaces_significant | for name and path comparisons, is trailing space to be considered significant. (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | case_sensitive_keys | for name and path comparisons, are they case sensitive. (default is true) |
|
logical(kind=LK), | intent(in), | optional | :: | no_whitespace | if true, printing the JSON structure is done without adding any non-significant spaces or linebreaks (default is false) |
|
logical(kind=LK), | intent(in), | optional | :: | unescape_strings | If false, then the raw escaped string is returned from json_get_string and similar routines. If true [default], then the string is returned unescaped. |
|
character(kind=CK,len=1), | intent(in), | optional | :: | comment_char | If present, this character is used
to denote comments in the JSON file,
which will be ignored if present.
Example: |
|
integer(kind=IK), | intent(in), | optional | :: | path_mode | How the path strings are interpreted in the
|
|
character(kind=CK,len=1), | intent(in), | optional | :: | path_separator | The |
|
logical(kind=LK), | intent(in), | optional | :: | compress_vectors | If true, then arrays of integers,
nulls, doubles, and logicals are
printed all on one line.
[Note: |
|
logical(kind=LK), | intent(in), | optional | :: | allow_duplicate_keys | ||
logical(kind=LK), | intent(in), | optional | :: | escape_solidus | ||
logical(kind=LK), | intent(in), | optional | :: | stop_on_error | If an exception is raised, then immediately quit. (Default is False). |
Alternate version of json_info that returns matrix information about a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | a JSON linked list |
||
logical(kind=LK), | intent(out) | :: | is_matrix | true if it is a valid matrix |
||
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type of data in the matrix (if all elements have the same type) |
|
integer(kind=IK), | intent(out), | optional | :: | n_sets | number of data sets (i.e., matrix rows if using row-major order) |
|
integer(kind=IK), | intent(out), | optional | :: | set_size | size of each data set (i.e., matrix cols if using row-major order) |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Returns matrix information about a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | a JSON linked list |
||
character(kind=CK,len=*), | intent(in) | :: | path | path to the variable |
||
logical(kind=LK), | intent(out) | :: | is_matrix | true if it is a valid matrix |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type of data in the matrix (if all elements have the same type) |
|
integer(kind=IK), | intent(out), | optional | :: | n_sets | number of data sets (i.e., matrix rows if using row-major order) |
|
integer(kind=IK), | intent(out), | optional | :: | set_size | size of each data set (i.e., matrix cols if using row-major order) |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Parse the JSON file and populate the json_value tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CDK,len=*), | intent(in) | :: | file | JSON file name |
||
type(json_value), | pointer | :: | p | output structure |
||
integer(kind=IK), | intent(in), | optional | :: | unit | file unit number (/= 0) |
Parse the JSON string and populate the json_value tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | output structure |
||
character(kind=CK,len=*), | intent(in) | :: | str | string with JSON data |
Print the json_value structure to a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
integer(kind=IK), | intent(in) | :: | iunit | the file unit (the file must already have been opened, can't be -1). |
Print the json_value structure to a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CDK,len=*), | intent(in) | :: | filename | the filename to print to (should not already be open) |
Print any error message, and then clear the exceptions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer, | intent(in), | optional | :: | io_unit |
Rename a json_value, given the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(in) | :: | name | the new name |
||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_rename_by_path, where "name" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_rename_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Returns information about character strings returned from a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
integer(kind=IK), | intent(out), | optional | dimension(:), allocatable | :: | ilen | if |
integer(kind=IK), | intent(out), | optional | :: | max_str_len | The maximum length required to
hold the string representation returned
by a call to a |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if there were no errors. if not present, an error will throw an exception |
Throw an exception in the json_core. This routine sets the error flag, and prevents any subsequent routine from doing anything, until json_clear_exceptions is called.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=*), | intent(in) | :: | msg | the error message |
Traverse a JSON structure. This routine calls the user-specified json_traverse_callback_func for each element of the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
procedure(json_traverse_callback_func) | :: | traverse_callback |
Given the path string, if the variable is present, and is a scalar, then update its value. If it is not present, then create it and set its value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Given the path string, if the variable is present, and is a scalar, then update its value. If it is not present, then create it and set its value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Given the path string, if the variable is present, and is a scalar, then update its value. If it is not present, then create it and set its value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Given the path string, if the variable is present, and is a scalar, then update its value. If it is not present, then create it and set its value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_update_string, where path
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_update_string, where val
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | path | |||
character(kind=CDK,len=*), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Add a real value child to the json_value variable
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | variable name |
||
real(kind=RK), | intent(in) | :: | val | real value |
Add a real vector to the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
real(kind=RK), | intent(in), | dimension(:) | :: | val |
Add an integer value child to the json_value variable
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
integer(kind=IK), | intent(in) | :: | val |
Add an integer vector to the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
integer(kind=IK), | intent(in), | dimension(:) | :: | val | value |
Add a logical value child to the json_value variable
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
logical(kind=LK), | intent(in) | :: | val | value |
Add a logical vector to the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the vector |
||
logical(kind=LK), | intent(in), | dimension(:) | :: | val | value |
Adds member
as a child of p
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
type(json_value), | pointer | :: | member | the child member
to add to |
Add a NULL value child to the json_value variable
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Add a character string child to the json_value variable.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CK,len=*), | intent(in) | :: | val | value |
||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_value_add_string where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CK,len=*), | intent(in) | :: | val | value |
||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_value_add_string where val
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CDK,len=*), | intent(in) | :: | val | value |
||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Add an array of character strings to the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | variable name |
||
character(kind=CK,len=*), | intent(in), | dimension(:) | :: | val | array of strings |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Alternate version of json_value_add_string_vec where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
character(kind=CK,len=*), | intent(in), | dimension(:) | :: | val | ||
logical(kind=LK), | intent(in), | optional | :: | trim_str | ||
logical(kind=LK), | intent(in), | optional | :: | adjustl_str |
Alternate version of json_value_add_string_vec where val
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
character(kind=CDK,len=*), | intent(in), | dimension(:) | :: | val | ||
logical(kind=LK), | intent(in), | optional | :: | trim_str | ||
logical(kind=LK), | intent(in), | optional | :: | adjustl_str |
Recursive deep copy function called by json_clone.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | pointer | :: | from | this is the structure to clone |
||
type(json_value), | pointer | :: | to | the clone is put here (it must not already be associated) |
||
type(json_value), | optional | pointer | :: | parent | to%parent |
|
type(json_value), | optional | pointer | :: | previous | to%previous |
|
type(json_value), | optional | pointer | :: | next | to%next |
|
type(json_value), | optional | pointer | :: | children | to%children |
|
logical, | optional | :: | tail | if "to" is the tail of its parent's children |
Allocate a json_value pointer variable. This should be called before adding data to it.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | pointer | :: | p |
Allocate a json_value pointer and make it an array variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Allocate a json_value pointer and make it a real(RK) variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
real(kind=RK), | intent(in) | :: | val | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Allocate a json_value pointer and make it an integer(IK) variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
integer(kind=IK), | intent(in) | :: | val | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Allocate a json_value pointer and make it a logical(LK) variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
logical(kind=LK), | intent(in) | :: | val | variable value |
||
character(kind=CK,len=*), | intent(in) | :: | name | variable name |
Allocate a json_value pointer and make it a null variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Allocate a json_value pointer and make it an object variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Allocate a json_value pointer and make it a string variable. The pointer should not already be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | val | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Destroy a json_value linked-list structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | variable to destroy |
||
logical(kind=LK), | intent(in), | optional | :: | destroy_next | if true, then |
Returns pointer to the first child of the object
(or null()
if it is not associated).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | object or array JSON data |
|
type(json_value), | pointer | :: | child | pointer to the child |
Returns a child in the object or array given the index.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | object or array JSON data |
|
integer(kind=IK), | intent(in) | :: | idx | index of the child (this is a 1-based Fortran style array index). |
||
type(json_value), | pointer | :: | child | pointer to the child |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if the value was found (if not present, an exception will be thrown if it was not found. If present and not found, no exception will be thrown). |
Returns a child in the object or array given the name string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CK,len=*), | intent(in) | :: | name | the name of a child of |
||
type(json_value), | pointer | :: | child | pointer to the child |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if the value was found (if not present, an exception will be thrown if it was not found. If present and not found, no exception will be thrown). |
Inserts element
after p
, and updates the JSON structure accordingly.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | a value from a JSON structure (presumably, this is a child of an object or array). |
||
type(json_value), | pointer | :: | element | the element to insert after |
Inserts element
after the idx
-th child of p
,
and updates the JSON structure accordingly. This is just
a wrapper for json_value_insert_after.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | a JSON object or array. |
||
integer(kind=IK), | intent(in) | :: | idx | the index of the child of |
||
type(json_value), | pointer | :: | element | the element to insert |
Print the JSON structure to a string or a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
integer(kind=IK), | intent(in) | :: | iunit | file unit to write to (6=console) |
||
character(kind=CK,len=:), | intent(inout), | allocatable | :: | str | if iunit==unit2str (-1) then the structure is printed to this string rather than a file. This mode is used by json_value_to_string. |
|
integer(kind=IK), | intent(in), | optional | :: | indent | indention level |
|
logical(kind=LK), | intent(in), | optional | :: | need_comma | if it needs a comma after it |
|
logical(kind=LK), | intent(in), | optional | :: | colon | if the colon was just written |
|
logical(kind=LK), | intent(in), | optional | :: | is_array_element | if this is an array element |
|
logical(kind=LK), | intent(in), | optional | :: | is_compressed_vector | if True, this is an element from an array being printed on one line [default is False] |
Remove a json_value (and all its children) from a linked-list structure, preserving the rest of the structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
logical(kind=LK), | intent(in), | optional | :: | destroy | If destroy is not present, it is also destroyed. If destroy is present and true, it is destroyed. If destroy is present and false, it is not destroyed. |
Given the path string, remove the variable from the json_value structure, if it exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name |
Rename a json_value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CK,len=*), | intent(in) | :: | name | new variable name |
Replace p1
with p2
in a JSON structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p1 | the item to replace |
||
type(json_value), | pointer | :: | p2 | item to take the place of |
||
logical(kind=LK), | intent(in), | optional | :: | destroy | Should |
Reverse the order of the children of an array or object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p |
Swap two elements in a JSON structure. All of the children are carried along as well.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p1 | |||
type(json_value), | pointer | :: | p2 |
Print the json_value structure to an allocatable string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CK,len=:), | intent(out), | allocatable | :: | str | prints structure to this string |
Validate a json_value linked list by checking to make sure all the pointers are properly associated, arrays and objects have the correct number of children, and the correct data is allocated for the variable types.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
logical(kind=LK), | intent(out) | :: | is_valid | True if the structure is valid. |
||
character(kind=CK,len=:), | intent(out), | allocatable | :: | error_msg | if not valid, this will contain a description of the problem |
Core parsing routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) |
||
type(json_value), | pointer | :: | array |
Core parsing routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) |
||
character(kind=CK,len=*), | intent(in) | :: | chars | the string to check for. |
Read a numerical value from the file (or string). The routine will determine if it is an integer or a double, and allocate the type accordingly.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) |
||
type(json_value), | pointer | :: | value |
Core parsing routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) |
||
type(json_value), | pointer | :: | parent | the parsed object will be added as a child of this |
Parses a string while reading a JSON file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) |
||
character(kind=CK,len=:), | intent(out), | allocatable | :: | string | the string (unescaped if necessary) |
Core parsing routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number |
||
character(kind=CK,len=*), | intent(in) | :: | str | string containing JSON data (only used if unit=0) |
||
type(json_value), | pointer | :: | value | JSON data that is extracted |
Get the next character from the file (or string).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
integer(kind=IK), | intent(in) | :: | unit | file unit number (if parsing from a file) |
||
character(kind=CK,len=*), | intent(in) | :: | str | JSON string (if parsing from a string) – only used if unit=0 |
||
logical(kind=LK), | intent(in), | optional | :: | skip_ws | to ignore whitespace [default False] |
|
logical(kind=LK), | intent(in), | optional | :: | skip_comments | to ignore comment lines [default False] |
|
logical(kind=LK), | intent(out) | :: | eof | true if the end of the file has been reached. |
||
character(kind=CK,len=1), | intent(out) | :: | popped | the popped character returned |
Core routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=1), | intent(in) | :: | c | to character to push |
Change the json_value variable to an array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to a double.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
real(kind=RK), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then 0.0_rk is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to an integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
integer(kind=IK), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then 0 is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to a logical.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
logical(kind=LK), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then .false. is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to a null.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to an object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Change the json_value variable to a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then '' is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Wrapper to json_add_double_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
real(kind=RK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper for json_add_double_vec_by_path where "path" is kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
real(kind=RK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_integer_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
integer(kind=IK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper for json_add_integer_vec_by_path where "path" is kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
integer(kind=IK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_logical_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
logical(kind=LK), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper for json_add_logical_vec_by_path where "path" is kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
logical(kind=LK), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_member_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
type(json_value), | intent(in), | pointer | :: | p | the value to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
Wrapper to json_add_string_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CDK,len=*), | intent(in) | :: | value | the value to add |
||
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Wrapper for json_add_string_vec_by_path where "path" and "value" are kind=CDK).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | the JSON structure |
||
character(kind=CDK,len=*), | intent(in) | :: | path | the path to the variable |
||
character(kind=CDK,len=*), | intent(in), | dimension(:) | :: | value | the vector to add |
|
logical(kind=LK), | intent(out), | optional | :: | found | if the variable was found |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | if the variable had to be created |
|
integer(kind=IK), | intent(in), | optional | dimension(:) | :: | ilen | the string lengths of each
element in |
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for each element |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for each element |
Alternate version of json_create_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | a JSON linked list |
|
character(kind=CDK,len=*), | intent(in) | :: | path | path to the variable |
||
type(json_value), | intent(out), | optional | pointer | :: | p | pointer to the variable
specify by |
logical(kind=LK), | intent(out), | optional | :: | found | true if there were no errors (variable found or created) |
|
logical(kind=LK), | intent(out), | optional | :: | was_created | true if it was actually created (as opposed to already being there) |
Alternate version of json_get_alloc_string_vec_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=:), | intent(out), | dimension(:), allocatable | :: | vec | ||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | ilen | the actual length of each character string in the array |
|
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_array_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
procedure(json_array_callback_func) | :: | array_callback | ||||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
type(json_value), | intent(out), | pointer | :: | p | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_double_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_double_vec_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_integer_by_path, where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_integer_vec_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | me | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_logical_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(out) | :: | value | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_logical_vec_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Wrapper for json_get_path where "path" and "path_sep" are kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list object |
|
character(kind=CDK,len=:), | intent(out), | allocatable | :: | path | path to the variable |
|
logical(kind=LK), | intent(out), | optional | :: | found | true if there were no problems |
|
logical(kind=LK), | intent(in), | optional | :: | use_alt_array_tokens | if true, then '()' are used for array elements otherwise, '[]' are used [default] |
|
character(kind=CDK,len=1), | intent(in), | optional | :: | path_sep | character to use for path separator (default is '.') |
Alternate version of json_get_string_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=:), | intent(out), | allocatable | :: | value | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_get_string_vec_by_path, where "path" is kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CK,len=*), | intent(out), | dimension(:), allocatable | :: | vec | ||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_info_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | a JSON linked list |
|
character(kind=CDK,len=*), | intent(in) | :: | path | path to the variable |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type |
|
integer(kind=IK), | intent(out), | optional | :: | n_children | number of children |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Alternate version of json_matrix_info_by_path where "path" is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | a JSON linked list |
||
character(kind=CDK,len=*), | intent(in) | :: | path | path to the variable |
||
logical(kind=LK), | intent(out) | :: | is_matrix | true if it is a valid matrix |
||
logical(kind=LK), | intent(out), | optional | :: | found | true if it was found |
|
integer(kind=IK), | intent(out), | optional | :: | var_type | variable type of data in the matrix (if all elements have the same type) |
|
integer(kind=IK), | intent(out), | optional | :: | n_sets | number of data sets (i.e., matrix rows if using row-major order) |
|
integer(kind=IK), | intent(out), | optional | :: | set_size | size of each data set (i.e., matrix cols if using row-major order) |
|
character(kind=CK,len=:), | intent(out), | optional | allocatable | :: | name | variable name |
Alternate version of json_parse_string, where str
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | output structure |
||
character(kind=CDK,len=*), | intent(in) | :: | str | string with JSON data |
Alternate version of json_rename_by_path, where "path" and "name" are kind=CDK
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | me | ||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_throw_exception, where msg
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CDK,len=*), | intent(in) | :: | msg | the error message |
Alternate version of json_update_double, where path
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
real(kind=RK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Alternate version of json_update_integer, where path
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
integer(kind=IK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Alternate version of json_update_logical, where path
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
logical(kind=LK), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found |
Alternate version of json_update_string, where path
and value
are kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | path | |||
character(kind=CDK,len=*), | intent(in) | :: | val | |||
logical(kind=LK), | intent(out) | :: | found | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_value_add_double where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | variable name |
||
real(kind=RK), | intent(in) | :: | val | real value |
Alternate version of json_value_add_double_vec where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
real(kind=RK), | intent(in), | dimension(:) | :: | val |
Alternate version of json_value_add_integer where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
integer(kind=IK), | intent(in) | :: | val | value |
Alternate version of json_value_add_integer_vec where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
integer(kind=IK), | intent(in), | dimension(:) | :: | val | value |
Alternate version of json_value_add_logical where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
logical(kind=LK), | intent(in) | :: | val | value |
Alternate version of json_value_add_logical_vec where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
logical(kind=LK), | intent(in), | dimension(:) | :: | val | value |
Alternate version of json_value_add_null where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
Alternate version of json_value_add_string where name
and val
are kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CDK,len=*), | intent(in) | :: | val | value |
||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_value_add_string_vec where name
and val
are kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
character(kind=CDK,len=*), | intent(in), | dimension(:) | :: | val | ||
logical(kind=LK), | intent(in), | optional | :: | trim_str | ||
logical(kind=LK), | intent(in), | optional | :: | adjustl_str |
A wrapper for json_value_create_array so that create_array
method may be
called with an actual argument, corresponding to the dummy argument name
,
that is either of 'DEFAULT' or 'ISO_10646' character kind.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
A wrapper for json_value_create_double so that create_double
method
may be called with an actual argument corresponding to the dummy argument,
name
that may be of 'DEFAULT' or 'ISO_10646' character kind.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
real(kind=RK), | intent(in) | :: | val | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
A wrapper procedure for json_value_create_integer so that create_integer
method may be called with either a 'DEFAULT' or 'ISO_10646' character kind
name
actual argument.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
integer(kind=IK), | intent(in) | :: | val | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
Wrapper for json_value_create_logical so create_logical
method can
be called with name of character kind 'DEFAULT' or 'ISO_10646'
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
logical(kind=LK), | intent(in) | :: | val | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
Wrap json_value_create_null so that create_null
method may be called with
an actual argument corresponding to the dummy argument name
that is either
of 'DEFAULT' or 'ISO_10646' character kind.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
Wrap json_value_create_object so that create_object
method may be called
with an actual argument corresponding to the dummy argument name
that is of
either 'DEFAULT' or 'ISO_10646' character kind.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
Wrap json_value_create_string so that create_string
method may be called
with actual character string arguments for name
and val
that are BOTH of
'DEFAULT' or 'ISO_10646' character kind.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | val | |||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
Alternate version of json_value_get_child_by_name where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CDK,len=*), | intent(in) | :: | name | |||
type(json_value), | pointer | :: | child | |||
logical(kind=LK), | intent(out), | optional | :: | found |
Alternate version of json_value_remove_if_present, where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CDK,len=*), | intent(in) | :: | name |
Alternate version of json_value_rename, where name
is kind=CDK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in), | pointer | :: | p | ||
character(kind=CDK,len=*), | intent(in) | :: | name | new variable name |