json_file Derived Type

type, public :: json_file

The json_file is the main public class that is used to open a file and get data from it.

A json_file contains only two items: an instance of a json_core, which is used for all data manipulation, and a json_value pointer, which is used to construct the linked-list data structure. Note that most methods in the json_file class are simply wrappers to the lower-level routines in the json_value_module.

Example

    program test
    use json_module
    implicit none
    type(json_file) :: json
    integer :: ival
    real(real64) :: rval
    character(len=:),allocatable :: cval
    logical :: found
    call json%initialize(compact_reals=.true.)
    call json%load(filename='myfile.json')
    call json%print() !print to the console
    call json%get('var.i',ival,found)
    call json%get('var.r(3)',rval,found)
    call json%get('var.c',cval,found)
    call json%destroy()
    end program test


Inherits

type~~json_file~~InheritsGraph type~json_file json_file type~json_value json_value type~json_file->type~json_value p type~json_core json_core type~json_file->type~json_core core type~json_value->type~json_value previous, next, parent, children, tail

Contents

Source Code


Components

TypeVisibility AttributesNameInitial
type(json_core), private :: core

The instance of the json_core factory used for this file.

type(json_value), private, pointer:: p=> null()

the JSON structure read from the file


Constructor

public interface json_file

Structure constructor to initialize a json_file object with an existing json_value object or a JSON string, and either the json_core settings or a json_core instance.

Read more…
  • private function initialize_json_file(p, 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, null_to_real_mode, non_normal_mode, use_quiet_nan, strict_integer_type_checking) result(file_object)

    Author
    Izaak Beekman
    Date
    07/23/2015

    Cast a json_value object as a json_file object. It also calls the initialize() method.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    type(json_value), optional pointer:: p

    json_value object to cast as a json_file object. This will be nullified.

    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 get routines (default is false).

    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=*), intent(in), optional :: comment_char

    If present, these characters are used to denote comments in the JSON file, which will be ignored if present. Example: !, #, or /!#. Setting this to a blank string disables the ignoring of comments. (Default is /!#).

    integer(kind=IK), intent(in), optional :: path_mode

    How the path strings are interpreted in the get_by_path routines:

    Read more…
    character(kind=CK,len=1), intent(in), optional :: path_separator

    The path separator to use in the “default” mode for the paths in the various get_by_path routines. Example: . [default] or %. Note: if path_mode/=1 then this is ignored.

    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: no_whitespace will override this option if necessary]. (Default is False).

    logical(kind=LK), intent(in), optional :: allow_duplicate_keysRead more…
    logical(kind=LK), intent(in), optional :: escape_solidus

    Note that this option does not affect parsing (both escaped and unescaped are still valid in all cases).

    Read more…
    logical(kind=LK), intent(in), optional :: stop_on_error

    If an exception is raised, then immediately quit. (Default is False).

    integer(kind=IK), intent(in), optional :: null_to_real_mode

    if strict_type_checking=false:

    Read more…
    integer(kind=IK), intent(in), optional :: non_normal_mode

    How to serialize NaN, Infinity, and -Infinity real values:

    Read more…
    logical(kind=LK), intent(in), optional :: use_quiet_nanRead more…
    logical(kind=LK), intent(in), optional :: strict_integer_type_checking

    (default is true)

    Read more…

    Return Value type(json_file)

  • private function initialize_json_file_v2(json_value_object, json_core_object) result(file_object)

    Author
    Jacob Williams
    Date
    4/26/2016

    Cast a json_value pointer and a json_core object as a json_file object.

    Arguments

    Type IntentOptional AttributesName
    type(json_value), intent(in), pointer:: json_value_object
    type(json_core), intent(in) :: json_core_object

    Return Value type(json_file)

  • private function initialize_json_file_from_string(str, 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, null_to_real_mode, non_normal_mode, use_quiet_nan, strict_integer_type_checking) result(file_object)

    Author
    Jacob Williams
    Date
    01/19/2019

    Cast a JSON string as a json_file object. It also calls the initialize() method.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    character(kind=CK,len=*), intent(in) :: str

    string to load JSON data from

    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 get routines (default is false).

    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=*), intent(in), optional :: comment_char

    If present, these characters are used to denote comments in the JSON file, which will be ignored if present. Example: !, #, or /!#. Setting this to a blank string disables the ignoring of comments. (Default is /!#).

    integer(kind=IK), intent(in), optional :: path_mode

    How the path strings are interpreted in the get_by_path routines:

    Read more…
    character(kind=CK,len=1), intent(in), optional :: path_separator

    The path separator to use in the “default” mode for the paths in the various get_by_path routines. Example: . [default] or %. Note: if path_mode/=1 then this is ignored.

    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: no_whitespace will override this option if necessary]. (Default is False).

    logical(kind=LK), intent(in), optional :: allow_duplicate_keysRead more…
    logical(kind=LK), intent(in), optional :: escape_solidus

    Note that this option does not affect parsing (both escaped and unescaped are still valid in all cases).

    Read more…
    logical(kind=LK), intent(in), optional :: stop_on_error

    If an exception is raised, then immediately quit. (Default is False).

    integer(kind=IK), intent(in), optional :: null_to_real_mode

    if strict_type_checking=false:

    Read more…
    integer(kind=IK), intent(in), optional :: non_normal_mode

    How to serialize NaN, Infinity, and -Infinity real values:

    Read more…
    logical(kind=LK), intent(in), optional :: use_quiet_nanRead more…
    logical(kind=LK), intent(in), optional :: strict_integer_type_checking

    (default is true)

    Read more…

    Return Value type(json_file)

  • private function initialize_json_file_from_string_v2(str, json_core_object) result(file_object)

    Author
    Jacob Williams
    Date
    1/19/2019

    Cast a JSON string and a json_core object as a json_file object.

    Arguments

    Type IntentOptional AttributesName
    character(kind=CK,len=*), intent(in) :: str

    string to load JSON data from

    type(json_core), intent(in) :: json_core_object

    Return Value type(json_file)


Finalization Procedures

final :: finalize_json_file


Type-Bound Procedures

Add a variable to a json_file, by specifying the path.

Example

  program test
  use json_module, rk=>json_rk, ik=>json_ik
  implicit none
  type(json_file) :: f
  call f%initialize()  ! specify whatever init options you want.
  call f%add('inputs.t', 0.0_rk)
  call f%add('inputs.x', [1.0_rk,2.0_rk,3.0_rk])
  call f%add('inputs.flag', .true.)
  call f%print()  ! print to the console
  end program test
  • private subroutine json_file_add(me, p, destroy_original)

    Author
    Jacob Williams

    Add a json_value pointer as the root object to a JSON file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    type(json_value), intent(in), pointer:: p

    pointer to the variable to add

    logical(kind=LK), intent(in), optional :: destroy_original

    if the file currently contains an associated pointer, it is destroyed. [Default is True]

  • private subroutine json_file_add_object(me, path, p, found, was_created)

    Author
    Jacob Williams

    Add a json_value pointer to an object to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    type(json_value), intent(in), pointer:: p

    pointer to the variable 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

  • private subroutine json_file_add_integer(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add an integer value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(in) :: val

    value

    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

  • private subroutine json_file_add_real32(me, path, val, found, was_created)

    Author
    Jacob Williams

    Alternate version of json_file_add_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(in) :: val

    value

    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

  • private subroutine json_file_add_real(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add a real(RK) variable value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(in) :: val

    value

    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

  • private subroutine json_file_add_logical(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add a logical(LK) value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(in) :: val

    value

    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

  • private subroutine json_file_add_string(me, path, val, found, was_created, trim_str, adjustl_str)

    Author
    Jacob Williams

    Add a character string to a json file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in) :: val

    value

    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 the val

    logical(kind=LK), intent(in), optional :: adjustl_str

    if ADJUSTL() should be called for the val (note that ADJUSTL is done before TRIM)

  • private subroutine json_file_add_integer_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add an integer vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(in), dimension(:):: vec

    the value vector

    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

  • private subroutine json_file_add_real32_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Alternate version of json_file_add_real_vec where vec is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(in), dimension(:):: vec

    the value vector

    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

  • private subroutine json_file_add_real_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add a real(RK) vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(in), dimension(:):: vec

    the value vector

    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

  • private subroutine json_file_add_logical_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add a logical(LK) vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(in), dimension(:):: vec

    the value vector

    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

  • private subroutine json_file_add_string_vec(me, path, vec, found, was_created, ilen, trim_str, adjustl_str)

    Author
    Jacob Williams

    Add a string vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in), dimension(:):: vec

    the value vector

    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 value. If not present, the full len(value) string is added for each element.

    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 (note that ADJUSTL is done before TRIM)

procedure, public :: assign_json_file

procedure, public, pass(me) :: assign_json_file_to_string

procedure, public :: assign_string_to_json_file

procedure, public :: check_for_errors => json_file_check_for_errors

  • private subroutine json_file_check_for_errors(me, status_ok, error_msg)

    Retrieve error status and message from the class.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    logical(kind=LK), intent(out), optional :: status_ok

    true if there were no errors

    character(kind=CK,len=:), intent(out), optional allocatable:: error_msg

    the error message (if there were errors)

procedure, public :: clear_exceptions => json_file_clear_exceptions

generic, public :: deserialize => json_file_load_from_string

Load JSON from a string.

  • private subroutine json_file_load_from_string(me, str)

    Author
    Jacob Williams
    Date
    1/13/2015

    Load the JSON data from a string.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: str

    string to load JSON data from

procedure, public :: destroy => json_file_destroy

  • private subroutine json_file_destroy(me, destroy_core)

    Author
    Jacob Williams

    Destroy the json_value data in a json_file. This may be done when the variable is no longer needed, or will be reused to open a different file. Otherwise a memory leak will occur.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    logical, intent(in), optional :: destroy_core

    to also destroy the json_core. default is to leave it as is.

procedure, public :: failed => json_file_failed

  • private pure function json_file_failed(me) result(failed)

    Check error status in the file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(in) :: me

    Return Value logical(kind=LK)

    will be true if there has been an error.

Get a variable from a json_file, by specifying the path.

  • private subroutine json_file_get_object(me, path, p, found)

    Author
    Jacob Williams
    Date
    2/3/2014

    Get a json_value pointer to an object from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    type(json_value), intent(out), pointer:: p

    pointer to the variable

    logical(kind=LK), intent(out), optional :: found

    if it was really found

  • private subroutine json_file_get_integer(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get an integer value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    integer(kind=IK), intent(in), optional :: default
  • private subroutine json_file_get_real32(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_get_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=real32), intent(in), optional :: default
  • private subroutine json_file_get_real(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a real(RK) variable value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=RK), intent(in), optional :: default
  • private subroutine json_file_get_logical(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a logical(LK) value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    logical(kind=LK), intent(in), optional :: default
  • private subroutine json_file_get_string(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a character string from a json file. The output val is an allocatable character string.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=:), intent(out), allocatable:: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    character(kind=CK,len=*), intent(in), optional :: default
  • private subroutine json_file_get_integer_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/20/2014

    Get an integer vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    integer(kind=IK), intent(in), optional dimension(:):: default
  • private subroutine json_file_get_real32_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_get_real_vec where vec is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=real32), intent(in), optional dimension(:):: default
  • private subroutine json_file_get_real_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/19/2014

    Get a real(RK) vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=RK), intent(in), optional dimension(:):: default
  • private subroutine json_file_get_logical_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/20/2014

    Get a logical(LK) vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    logical(kind=LK), intent(in), optional dimension(:):: default
  • private subroutine json_file_get_string_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/19/2014

    Get a string vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(out), dimension(:), allocatable:: vec

    value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    character(kind=CK,len=*), intent(in), optional dimension(:):: default
  • private subroutine json_file_get_alloc_string_vec(me, path, vec, ilen, found, default, default_ilen)

    Author
    Jacob Williams
    Date
    12/17/2016

    Get an (allocatable length) string vector from a JSON file. This is just a wrapper for json_get_alloc_string_vec_by_path.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=:), intent(out), dimension(:), allocatable:: vec

    value vector

    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
    character(kind=CK,len=*), intent(in), optional dimension(:):: default
    integer(kind=IK), intent(in), optional dimension(:):: default_ilen

    the actual length of default

  • private subroutine json_file_get_root(me, p)

    Author
    Izaak Beekman
    Date
    7/23/2015

    Get a json_value pointer to the JSON file root.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    type(json_value), intent(out), pointer:: p

    pointer to the variable

procedure, public :: get_core => get_json_core_in_file

generic, public :: info => json_file_variable_info

  • private subroutine json_file_variable_info(me, path, found, var_type, n_children, name)

    Author
    Jacob Williams
    Date
    2/3/2014

    Returns information about a variable in a json_file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    path to the variable

    logical(kind=LK), intent(out), optional :: found

    the variable exists in the structure

    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

generic, public :: initialize => initialize_json_core_in_file, set_json_core_in_file

  • private subroutine initialize_json_core_in_file(me, 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, null_to_real_mode, non_normal_mode, use_quiet_nan, strict_integer_type_checking)

    Initialize the json_core for this json_file. This is just a wrapper for json_initialize.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), 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 get routines (default is false).

    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=*), intent(in), optional :: comment_char

    If present, these characters are used to denote comments in the JSON file, which will be ignored if present. Example: !, #, or /!#. Setting this to a blank string disables the ignoring of comments. (Default is /!#).

    integer(kind=IK), intent(in), optional :: path_mode

    How the path strings are interpreted in the get_by_path routines:

    Read more…
    character(kind=CK,len=1), intent(in), optional :: path_separator

    The path separator to use in the “default” mode for the paths in the various get_by_path routines. Example: . [default] or %. Note: if path_mode/=1 then this is ignored.

    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: no_whitespace will override this option if necessary]. (Default is False).

    logical(kind=LK), intent(in), optional :: allow_duplicate_keysRead more…
    logical(kind=LK), intent(in), optional :: escape_solidus

    Note that this option does not affect parsing (both escaped and unescaped are still valid in all cases).

    Read more…
    logical(kind=LK), intent(in), optional :: stop_on_error

    If an exception is raised, then immediately quit. (Default is False).

    integer(kind=IK), intent(in), optional :: null_to_real_mode

    if strict_type_checking=false:

    Read more…
    integer(kind=IK), intent(in), optional :: non_normal_mode

    How to serialize NaN, Infinity, and -Infinity real values:

    Read more…
    logical(kind=LK), intent(in), optional :: use_quiet_nanRead more…
    logical(kind=LK), intent(in), optional :: strict_integer_type_checking

    (default is true)

    Read more…
  • private subroutine set_json_core_in_file(me, core)

    Set the json_core for this json_file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    type(json_core), intent(in) :: core

procedure, public :: initialize_json_core_in_file

  • private subroutine initialize_json_core_in_file(me, 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, null_to_real_mode, non_normal_mode, use_quiet_nan, strict_integer_type_checking)

    Initialize the json_core for this json_file. This is just a wrapper for json_initialize.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), 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 get routines (default is false).

    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=*), intent(in), optional :: comment_char

    If present, these characters are used to denote comments in the JSON file, which will be ignored if present. Example: !, #, or /!#. Setting this to a blank string disables the ignoring of comments. (Default is /!#).

    integer(kind=IK), intent(in), optional :: path_mode

    How the path strings are interpreted in the get_by_path routines:

    Read more…
    character(kind=CK,len=1), intent(in), optional :: path_separator

    The path separator to use in the “default” mode for the paths in the various get_by_path routines. Example: . [default] or %. Note: if path_mode/=1 then this is ignored.

    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: no_whitespace will override this option if necessary]. (Default is False).

    logical(kind=LK), intent(in), optional :: allow_duplicate_keysRead more…
    logical(kind=LK), intent(in), optional :: escape_solidus

    Note that this option does not affect parsing (both escaped and unescaped are still valid in all cases).

    Read more…
    logical(kind=LK), intent(in), optional :: stop_on_error

    If an exception is raised, then immediately quit. (Default is False).

    integer(kind=IK), intent(in), optional :: null_to_real_mode

    if strict_type_checking=false:

    Read more…
    integer(kind=IK), intent(in), optional :: non_normal_mode

    How to serialize NaN, Infinity, and -Infinity real values:

    Read more…
    logical(kind=LK), intent(in), optional :: use_quiet_nanRead more…
    logical(kind=LK), intent(in), optional :: strict_integer_type_checking

    (default is true)

    Read more…

procedure, public :: json_file_add

  • private subroutine json_file_add(me, p, destroy_original)

    Author
    Jacob Williams

    Add a json_value pointer as the root object to a JSON file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    type(json_value), intent(in), pointer:: p

    pointer to the variable to add

    logical(kind=LK), intent(in), optional :: destroy_original

    if the file currently contains an associated pointer, it is destroyed. [Default is True]

procedure, public :: json_file_add_integer

  • private subroutine json_file_add_integer(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add an integer value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(in) :: val

    value

    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

procedure, public :: json_file_add_integer_vec

  • private subroutine json_file_add_integer_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add an integer vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(in), dimension(:):: vec

    the value vector

    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

procedure, public :: json_file_add_logical

  • private subroutine json_file_add_logical(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add a logical(LK) value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(in) :: val

    value

    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

procedure, public :: json_file_add_logical_vec

  • private subroutine json_file_add_logical_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add a logical(LK) vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(in), dimension(:):: vec

    the value vector

    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

procedure, public :: json_file_add_object

  • private subroutine json_file_add_object(me, path, p, found, was_created)

    Author
    Jacob Williams

    Add a json_value pointer to an object to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    type(json_value), intent(in), pointer:: p

    pointer to the variable 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

procedure, public :: json_file_add_real

  • private subroutine json_file_add_real(me, path, val, found, was_created)

    Author
    Jacob Williams

    Add a real(RK) variable value to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(in) :: val

    value

    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

procedure, public :: json_file_add_real32

  • private subroutine json_file_add_real32(me, path, val, found, was_created)

    Author
    Jacob Williams

    Alternate version of json_file_add_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(in) :: val

    value

    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

procedure, public :: json_file_add_real32_vec

  • private subroutine json_file_add_real32_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Alternate version of json_file_add_real_vec where vec is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(in), dimension(:):: vec

    the value vector

    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

procedure, public :: json_file_add_real_vec

  • private subroutine json_file_add_real_vec(me, path, vec, found, was_created)

    Author
    Jacob Williams

    Add a real(RK) vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(in), dimension(:):: vec

    the value vector

    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

procedure, public :: json_file_add_string

  • private subroutine json_file_add_string(me, path, val, found, was_created, trim_str, adjustl_str)

    Author
    Jacob Williams

    Add a character string to a json file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in) :: val

    value

    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 the val

    logical(kind=LK), intent(in), optional :: adjustl_str

    if ADJUSTL() should be called for the val (note that ADJUSTL is done before TRIM)

procedure, public :: json_file_add_string_vec

  • private subroutine json_file_add_string_vec(me, path, vec, found, was_created, ilen, trim_str, adjustl_str)

    Author
    Jacob Williams

    Add a string vector to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in), dimension(:):: vec

    the value vector

    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 value. If not present, the full len(value) string is added for each element.

    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 (note that ADJUSTL is done before TRIM)

procedure, public :: json_file_get_alloc_string_vec

  • private subroutine json_file_get_alloc_string_vec(me, path, vec, ilen, found, default, default_ilen)

    Author
    Jacob Williams
    Date
    12/17/2016

    Get an (allocatable length) string vector from a JSON file. This is just a wrapper for json_get_alloc_string_vec_by_path.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=:), intent(out), dimension(:), allocatable:: vec

    value vector

    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
    character(kind=CK,len=*), intent(in), optional dimension(:):: default
    integer(kind=IK), intent(in), optional dimension(:):: default_ilen

    the actual length of default

procedure, public :: json_file_get_integer

  • private subroutine json_file_get_integer(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get an integer value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    integer(kind=IK), intent(in), optional :: default

procedure, public :: json_file_get_integer_vec

  • private subroutine json_file_get_integer_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/20/2014

    Get an integer vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    integer(kind=IK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    integer(kind=IK), intent(in), optional dimension(:):: default

procedure, public :: json_file_get_logical

  • private subroutine json_file_get_logical(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a logical(LK) value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    logical(kind=LK), intent(in), optional :: default

procedure, public :: json_file_get_logical_vec

  • private subroutine json_file_get_logical_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/20/2014

    Get a logical(LK) vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    logical(kind=LK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    logical(kind=LK), intent(in), optional dimension(:):: default

procedure, public :: json_file_get_object

  • private subroutine json_file_get_object(me, path, p, found)

    Author
    Jacob Williams
    Date
    2/3/2014

    Get a json_value pointer to an object from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    type(json_value), intent(out), pointer:: p

    pointer to the variable

    logical(kind=LK), intent(out), optional :: found

    if it was really found

procedure, public :: json_file_get_real

  • private subroutine json_file_get_real(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a real(RK) variable value from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=RK), intent(in), optional :: default

procedure, public :: json_file_get_real32

  • private subroutine json_file_get_real32(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_get_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(out) :: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=real32), intent(in), optional :: default

procedure, public :: json_file_get_real32_vec

  • private subroutine json_file_get_real32_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_get_real_vec where vec is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=real32), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=real32), intent(in), optional dimension(:):: default

procedure, public :: json_file_get_real_vec

  • private subroutine json_file_get_real_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/19/2014

    Get a real(RK) vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    real(kind=RK), intent(out), dimension(:), allocatable:: vec

    the value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    real(kind=RK), intent(in), optional dimension(:):: default

procedure, public :: json_file_get_root

procedure, public :: json_file_get_string

  • private subroutine json_file_get_string(me, path, val, found, default)

    Author
    Jacob Williams
    Date
    12/9/2013

    Get a character string from a json file. The output val is an allocatable character string.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=:), intent(out), allocatable:: val

    value

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    character(kind=CK,len=*), intent(in), optional :: default

procedure, public :: json_file_get_string_vec

  • private subroutine json_file_get_string_vec(me, path, vec, found, default)

    Author
    Jacob Williams
    Date
    1/19/2014

    Get a string vector from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(out), dimension(:), allocatable:: vec

    value vector

    logical(kind=LK), intent(out), optional :: found

    if it was really found

    character(kind=CK,len=*), intent(in), optional dimension(:):: default

procedure, public :: json_file_load_from_string

  • private subroutine json_file_load_from_string(me, str)

    Author
    Jacob Williams
    Date
    1/13/2015

    Load the JSON data from a string.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: str

    string to load JSON data from

procedure, public :: json_file_print_to_console

  • private subroutine json_file_print_to_console(me)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON file to the console.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me

procedure, public :: json_file_print_to_filename

  • private subroutine json_file_print_to_filename(me, filename)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON structure to the specified filename. The file is opened, printed, and then closed.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CDK,len=*), intent(in) :: filename

    filename to print to

procedure, public :: json_file_print_to_unit

  • private subroutine json_file_print_to_unit(me, iunit)

    Author
    Jacob Williams
    Date
    12/9/2013

    Prints the JSON file to the specified file unit number.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    integer(kind=IK), intent(in) :: iunit

    file unit number (must not be -1)

procedure, public :: json_file_remove

  • private subroutine json_file_remove(me, path)

    Author
    Jacob Williams
    Date
    7/7/2018

    Remove a variable from a JSON file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

procedure, public :: json_file_rename

  • private subroutine json_file_rename(me, path, name, found)

    Author
    Jacob Williams

    Rename a variable in a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in) :: name

    the new name

    logical(kind=LK), intent(out), optional :: found

    if the variable was found

procedure, public :: json_file_update_integer

  • private subroutine json_file_update_integer(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    integer(kind=IK), intent(in) :: val
    logical(kind=LK), intent(out) :: found

procedure, public :: json_file_update_logical

  • private subroutine json_file_update_logical(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    logical(kind=LK), intent(in) :: val
    logical(kind=LK), intent(out) :: found

procedure, public :: json_file_update_real

  • private subroutine json_file_update_real(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    real(kind=RK), intent(in) :: val
    logical(kind=LK), intent(out) :: found

procedure, public :: json_file_update_real32

  • private subroutine json_file_update_real32(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_update_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    real(kind=real32), intent(in) :: val
    logical(kind=LK), intent(out) :: found

procedure, public :: json_file_update_string

  • private subroutine json_file_update_string(me, path, val, found, trim_str, adjustl_str)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    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 val

    logical(kind=LK), intent(in), optional :: adjustl_str

    if ADJUSTL() should be called for the val (note that ADJUSTL is done before TRIM)

procedure, public :: json_file_valid_path

  • private function json_file_valid_path(me, path) result(found)

    Author
    Jacob Williams

    Returns true if the path is present in the JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    Return Value logical(kind=LK)

    if the variable was found

procedure, public, pass(me) :: json_file_valid_path_op

  • private function json_file_valid_path_op(path, me) result(found)

    Author
    Jacob Williams

    A wrapper for json_file_valid_path for the .in. operator

    Arguments

    Type IntentOptional AttributesName
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    class(json_file), intent(in) :: me

    the JSON file

    Return Value logical(kind=LK)

    if the variable was found

procedure, public :: json_file_variable_info

  • private subroutine json_file_variable_info(me, path, found, var_type, n_children, name)

    Author
    Jacob Williams
    Date
    2/3/2014

    Returns information about a variable in a json_file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    path to the variable

    logical(kind=LK), intent(out), optional :: found

    the variable exists in the structure

    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

procedure, public :: json_file_variable_matrix_info

  • private subroutine json_file_variable_matrix_info(me, path, is_matrix, found, var_type, n_sets, set_size, name)

    Author
    Jacob Williams
    Date
    6/26/2016

    Returns matrix information about a variable in a json_file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    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

procedure, public :: load => json_file_load

Load JSON from a file.

  • private subroutine json_file_load(me, filename, unit)

    Author
    Jacob Williams
    Date
    12/9/2013

    Load the JSON data from a file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CDK,len=*), intent(in) :: filename

    the filename to open

    integer(kind=IK), intent(in), optional :: unit

    the unit number to use (if not present, a newunit is used)

procedure, public :: load_file => json_file_load

The same as load, but only here for backward compatibility

  • private subroutine json_file_load(me, filename, unit)

    Author
    Jacob Williams
    Date
    12/9/2013

    Load the JSON data from a file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CDK,len=*), intent(in) :: filename

    the filename to open

    integer(kind=IK), intent(in), optional :: unit

    the unit number to use (if not present, a newunit is used)

generic, public :: load_from_string => json_file_load_from_string

The same as deserialize, but only here for backward compatibility

  • private subroutine json_file_load_from_string(me, str)

    Author
    Jacob Williams
    Date
    1/13/2015

    Load the JSON data from a string.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: str

    string to load JSON data from

generic, public :: matrix_info => json_file_variable_matrix_info

  • private subroutine json_file_variable_matrix_info(me, path, is_matrix, found, var_type, n_sets, set_size, name)

    Author
    Jacob Williams
    Date
    6/26/2016

    Returns matrix information about a variable in a json_file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    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

procedure, public :: move => json_file_move_pointer

procedure, public :: nullify => json_file_nullify

generic, public :: operator(.in.) => json_file_valid_path_op

  • private function json_file_valid_path_op(path, me) result(found)

    Author
    Jacob Williams

    A wrapper for json_file_valid_path for the .in. operator

    Arguments

    Type IntentOptional AttributesName
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    class(json_file), intent(in) :: me

    the JSON file

    Return Value logical(kind=LK)

    if the variable was found

  • private subroutine json_file_print_to_console(me)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON file to the console.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
  • private subroutine json_file_print_to_unit(me, iunit)

    Author
    Jacob Williams
    Date
    12/9/2013

    Prints the JSON file to the specified file unit number.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    integer(kind=IK), intent(in) :: iunit

    file unit number (must not be -1)

  • private subroutine json_file_print_to_filename(me, filename)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON structure to the specified filename. The file is opened, printed, and then closed.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CDK,len=*), intent(in) :: filename

    filename to print to

procedure, public :: print_error_message => json_file_print_error_message

The same as print, but only here for backward compatibility

  • private subroutine json_file_print_to_console(me)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON file to the console.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
  • private subroutine json_file_print_to_unit(me, iunit)

    Author
    Jacob Williams
    Date
    12/9/2013

    Prints the JSON file to the specified file unit number.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    integer(kind=IK), intent(in) :: iunit

    file unit number (must not be -1)

  • private subroutine json_file_print_to_filename(me, filename)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON structure to the specified filename. The file is opened, printed, and then closed.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CDK,len=*), intent(in) :: filename

    filename to print to

procedure, public :: print_to_string => json_file_print_to_string

The same as serialize, but only here for backward compatibility

  • private subroutine json_file_print_to_string(me, str)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON file to a string.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=:), intent(out), allocatable:: str

    string to print JSON data to

generic, public :: remove => json_file_remove

Remove a variable from a json_file by specifying the path.

  • private subroutine json_file_remove(me, path)

    Author
    Jacob Williams
    Date
    7/7/2018

    Remove a variable from a JSON file.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

generic, public :: rename => json_file_rename

Rename a variable, specifying it by path

  • private subroutine json_file_rename(me, path, name, found)

    Author
    Jacob Williams

    Rename a variable in a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    character(kind=CK,len=*), intent(in) :: name

    the new name

    logical(kind=LK), intent(out), optional :: found

    if the variable was found

procedure, public :: serialize => json_file_print_to_string

Print the json_value structure to an allocatable string

  • private subroutine json_file_print_to_string(me, str)

    Author
    Jacob Williams
    Date
    1/11/2015

    Print the JSON file to a string.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=:), intent(out), allocatable:: str

    string to print JSON data to

procedure, public :: set_json_core_in_file

procedure, public :: traverse => json_file_traverse

Update a scalar variable in a json_file, by specifying the path.

  • private subroutine json_file_update_integer(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    integer(kind=IK), intent(in) :: val
    logical(kind=LK), intent(out) :: found
  • private subroutine json_file_update_logical(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    logical(kind=LK), intent(in) :: val
    logical(kind=LK), intent(out) :: found
  • private subroutine json_file_update_real32(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/21/2019

    Alternate version of json_file_update_real where val is real32.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    real(kind=real32), intent(in) :: val
    logical(kind=LK), intent(out) :: found
  • private subroutine json_file_update_real(me, path, val, found)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path
    real(kind=RK), intent(in) :: val
    logical(kind=LK), intent(out) :: found
  • private subroutine json_file_update_string(me, path, val, found, trim_str, adjustl_str)

    Author
    Jacob Williams
    Date
    1/10/2015

    Given the path string, if the variable is present in the file, and is a scalar, then update its value. If it is not present, then create it and set its value.

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    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 val

    logical(kind=LK), intent(in), optional :: adjustl_str

    if ADJUSTL() should be called for the val (note that ADJUSTL is done before TRIM)

generic, public :: valid_path => json_file_valid_path

Verify that a path is valid (i.e., a variable with this path exists in the file).

  • private function json_file_valid_path(me, path) result(found)

    Author
    Jacob Williams

    Returns true if the path is present in the JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(json_file), intent(inout) :: me
    character(kind=CK,len=*), intent(in) :: path

    the path to the variable

    Return Value logical(kind=LK)

    if the variable was found

Source Code

    type,public :: json_file

        private

        type(json_core)          :: core         !! The instance of the [[json_core(type)]]
                                                 !! factory used for this file.
        type(json_value),pointer :: p => null()  !! the JSON structure read from the file

    contains

        generic,public :: initialize => initialize_json_core_in_file,&
                                        set_json_core_in_file

        procedure,public :: get_core => get_json_core_in_file

        !>
        !  Load JSON from a file.
        procedure,public :: load => json_file_load

        !>
        !  The same as `load`, but only here for backward compatibility
        procedure,public :: load_file => json_file_load

        !>
        !  Load JSON from a string.
        generic,public :: deserialize => MAYBEWRAP(json_file_load_from_string)

        !>
        !  The same as `deserialize`, but only here for backward compatibility
        generic,public :: load_from_string => MAYBEWRAP(json_file_load_from_string)

        !>
        !  Print the [[json_value]] structure to an allocatable string
        procedure,public :: serialize => json_file_print_to_string

        !>
        !  The same as `serialize`, but only here for backward compatibility
        procedure,public :: print_to_string => json_file_print_to_string

        procedure,public :: destroy => json_file_destroy
        procedure,public :: nullify => json_file_nullify
        procedure,public :: move    => json_file_move_pointer
        generic,public   :: info    => MAYBEWRAP(json_file_variable_info)
        generic,public   :: matrix_info => MAYBEWRAP(json_file_variable_matrix_info)

        !error checking:
        procedure,public :: failed => json_file_failed
        procedure,public :: print_error_message => json_file_print_error_message
        procedure,public :: check_for_errors => json_file_check_for_errors
        procedure,public :: clear_exceptions => json_file_clear_exceptions

        generic,public :: print => json_file_print_to_console, &
                                   json_file_print_to_unit, &
                                   json_file_print_to_filename

        !>
        !  The same as `print`, but only here for backward compatibility
        generic,public :: print_file => json_file_print_to_console, &
                                        json_file_print_to_unit, &
                                        json_file_print_to_filename

        !>
        !  Rename a variable, specifying it by path
        generic,public :: rename => MAYBEWRAP(json_file_rename)
#ifdef USE_UCS4
        generic,public :: rename => json_file_rename_path_ascii, &
                                    json_file_rename_name_ascii
#endif

        !>
        !  Verify that a path is valid
        !  (i.e., a variable with this path exists in the file).
        generic,public :: valid_path => MAYBEWRAP(json_file_valid_path)

        !>
        !  Get a variable from a [[json_file(type)]], by specifying the path.
        generic,public :: get => MAYBEWRAP(json_file_get_object),      &
                                 MAYBEWRAP(json_file_get_integer),     &
#ifndef REAL32
                                 MAYBEWRAP(json_file_get_real32),      &
#endif
                                 MAYBEWRAP(json_file_get_real),        &
#ifdef REAL128
                                 MAYBEWRAP(json_file_get_real64),      &
#endif
                                 MAYBEWRAP(json_file_get_logical),     &
                                 MAYBEWRAP(json_file_get_string),      &
                                 MAYBEWRAP(json_file_get_integer_vec), &
#ifndef REAL32
                                 MAYBEWRAP(json_file_get_real32_vec),  &
#endif
                                 MAYBEWRAP(json_file_get_real_vec),    &
#ifdef REAL128
                                 MAYBEWRAP(json_file_get_real64_vec),  &
#endif
                                 MAYBEWRAP(json_file_get_logical_vec), &
                                 MAYBEWRAP(json_file_get_string_vec),  &
                                 MAYBEWRAP(json_file_get_alloc_string_vec),  &
                                 json_file_get_root

        !>
        !  Add a variable to a [[json_file(type)]], by specifying the path.
        !
        !### Example
        !
        !```fortran
        !  program test
        !  use json_module, rk=>json_rk, ik=>json_ik
        !  implicit none
        !  type(json_file) :: f
        !  call f%initialize()  ! specify whatever init options you want.
        !  call f%add('inputs.t', 0.0_rk)
        !  call f%add('inputs.x', [1.0_rk,2.0_rk,3.0_rk])
        !  call f%add('inputs.flag', .true.)
        !  call f%print()  ! print to the console
        !  end program test
        !```
        generic,public :: add => json_file_add, &
                                 MAYBEWRAP(json_file_add_object),      &
                                 MAYBEWRAP(json_file_add_integer),     &
#ifndef REAL32
                                 MAYBEWRAP(json_file_add_real32),      &
#endif
                                 MAYBEWRAP(json_file_add_real),        &
#ifdef REAL128
                                 MAYBEWRAP(json_file_add_real64),      &
#endif
                                 MAYBEWRAP(json_file_add_logical),     &
                                 MAYBEWRAP(json_file_add_string),      &
                                 MAYBEWRAP(json_file_add_integer_vec), &
#ifndef REAL32
                                 MAYBEWRAP(json_file_add_real32_vec),  &
#endif
                                 MAYBEWRAP(json_file_add_real_vec),    &
#ifdef REAL128
                                 MAYBEWRAP(json_file_add_real64_vec),  &
#endif
                                 MAYBEWRAP(json_file_add_logical_vec), &
                                 MAYBEWRAP(json_file_add_string_vec)
#ifdef USE_UCS4
        generic,public :: add => json_file_add_string_path_ascii, &
                                 json_file_add_string_value_ascii,&
                                 json_file_add_string_vec_path_ascii,&
                                 json_file_add_string_vec_vec_ascii
#endif

        !>
        !  Update a scalar variable in a [[json_file(type)]],
        !  by specifying the path.
        !
        !@note These have been mostly supplanted by the `add`
        !      methods, which do a similar thing (and can be used for
        !      scalars and vectors, etc.)
        generic,public :: update =>  MAYBEWRAP(json_file_update_integer),  &
                                     MAYBEWRAP(json_file_update_logical),  &
#ifndef REAL32
                                     MAYBEWRAP(json_file_update_real32),   &
#endif
                                     MAYBEWRAP(json_file_update_real),     &
#ifdef REAL128
                                     MAYBEWRAP(json_file_update_real64),   &
#endif
                                     MAYBEWRAP(json_file_update_string)
#ifdef USE_UCS4
        generic,public :: update => json_file_update_string_name_ascii, &
                                    json_file_update_string_val_ascii
#endif

        !>
        !  Remove a variable from a [[json_file(type)]]
        !  by specifying the path.
        generic,public :: remove =>  MAYBEWRAP(json_file_remove)

        !traverse
        procedure,public :: traverse => json_file_traverse

        ! ***************************************************
        ! operators
        ! ***************************************************

        generic,public :: operator(.in.) => MAYBEWRAP(json_file_valid_path_op)
        procedure,pass(me) :: MAYBEWRAP(json_file_valid_path_op)

        generic,public :: assignment(=) => assign_json_file,&
                                           assign_json_file_to_string,&
                                           MAYBEWRAP(assign_string_to_json_file)
        procedure :: assign_json_file
        procedure,pass(me) :: assign_json_file_to_string
        procedure :: MAYBEWRAP(assign_string_to_json_file)

        ! ***************************************************
        ! private routines
        ! ***************************************************

        !load from string:
        procedure :: MAYBEWRAP(json_file_load_from_string)

        !initialize
        procedure :: initialize_json_core_in_file
        procedure :: set_json_core_in_file

        !get info:
        procedure :: MAYBEWRAP(json_file_variable_info)
        procedure :: MAYBEWRAP(json_file_variable_matrix_info)

        !rename:
        procedure :: MAYBEWRAP(json_file_rename)
#ifdef USE_UCS4
        procedure :: json_file_rename_path_ascii
        procedure :: json_file_rename_name_ascii
#endif

        !validate path:
        procedure :: MAYBEWRAP(json_file_valid_path)

        !get:
        procedure :: MAYBEWRAP(json_file_get_object)
        procedure :: MAYBEWRAP(json_file_get_integer)
#ifndef REAL32
        procedure :: MAYBEWRAP(json_file_get_real32)
#endif
        procedure :: MAYBEWRAP(json_file_get_real)
#ifdef REAL128
        procedure :: MAYBEWRAP(json_file_get_real64)
#endif
        procedure :: MAYBEWRAP(json_file_get_logical)
        procedure :: MAYBEWRAP(json_file_get_string)
        procedure :: MAYBEWRAP(json_file_get_integer_vec)
#ifndef REAL32
        procedure :: MAYBEWRAP(json_file_get_real32_vec)
#endif
        procedure :: MAYBEWRAP(json_file_get_real_vec)
#ifdef REAL128
        procedure :: MAYBEWRAP(json_file_get_real64_vec)
#endif
        procedure :: MAYBEWRAP(json_file_get_logical_vec)
        procedure :: MAYBEWRAP(json_file_get_string_vec)
        procedure :: MAYBEWRAP(json_file_get_alloc_string_vec)
        procedure :: json_file_get_root

        !add:
        procedure :: json_file_add
        procedure :: MAYBEWRAP(json_file_add_object)
        procedure :: MAYBEWRAP(json_file_add_integer)
#ifndef REAL32
        procedure :: MAYBEWRAP(json_file_add_real32)
#endif
        procedure :: MAYBEWRAP(json_file_add_real)
#ifdef REAL128
        procedure :: MAYBEWRAP(json_file_add_real64)
#endif
        procedure :: MAYBEWRAP(json_file_add_logical)
        procedure :: MAYBEWRAP(json_file_add_string)
        procedure :: MAYBEWRAP(json_file_add_integer_vec)
#ifndef REAL32
        procedure :: MAYBEWRAP(json_file_add_real32_vec)
#endif
        procedure :: MAYBEWRAP(json_file_add_real_vec)
#ifdef REAL128
        procedure :: MAYBEWRAP(json_file_add_real64_vec)
#endif
        procedure :: MAYBEWRAP(json_file_add_logical_vec)
        procedure :: MAYBEWRAP(json_file_add_string_vec)
#ifdef USE_UCS4
        procedure :: json_file_add_string_path_ascii
        procedure :: json_file_add_string_value_ascii
        procedure :: json_file_add_string_vec_path_ascii
        procedure :: json_file_add_string_vec_vec_ascii
#endif

        !update:
        procedure :: MAYBEWRAP(json_file_update_integer)
        procedure :: MAYBEWRAP(json_file_update_logical)
#ifndef REAL32
        procedure :: MAYBEWRAP(json_file_update_real32)
#endif
        procedure :: MAYBEWRAP(json_file_update_real)
#ifdef REAL128
        procedure :: MAYBEWRAP(json_file_update_real64)
#endif
        procedure :: MAYBEWRAP(json_file_update_string)
#ifdef USE_UCS4
        procedure :: json_file_update_string_name_ascii
        procedure :: json_file_update_string_val_ascii
#endif

        !remove:
        procedure :: MAYBEWRAP(json_file_remove)

        !print:
        procedure :: json_file_print_to_console
        procedure :: json_file_print_to_unit
        procedure :: json_file_print_to_filename

        final :: finalize_json_file

    end type json_file