json_info Subroutine

private subroutine json_info(json, p, var_type, n_children, name)

Returns information about a json_value.

Arguments

Type IntentOptional AttributesName
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


Contents

Source Code


Source Code

    subroutine json_info(json,p,var_type,n_children,name)

    implicit none

    class(json_core),intent(inout)   :: json
    type(json_value),pointer         :: p
    integer(IK),intent(out),optional :: var_type   !! variable type
    integer(IK),intent(out),optional :: n_children !! number of children
    character(kind=CK,len=:),allocatable,intent(out),optional :: name !! variable name

    if (present(var_type))    var_type   = p%var_type
    if (present(n_children))  n_children = json%count(p)
    if (present(name)) then
        if (allocated(p%name)) then
            name = p%name
        else
            name = CK_''
        end if
    end if

    end subroutine json_info