json_get_real_vec_by_path Subroutine

private subroutine json_get_real_vec_by_path(json, me, path, vec, found)

Get a real vector from a json_value, given the path.

Arguments

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

Contents


Source Code

    subroutine json_get_real_vec_by_path(json, me, path, vec, found)

    implicit none

    class(json_core),intent(inout)                :: json
    type(json_value),pointer,intent(in)           :: me
    character(kind=CK,len=*),intent(in)           :: path
    real(RK),dimension(:),allocatable,intent(out) :: vec
    logical(LK),intent(out),optional              :: found

    type(json_value),pointer :: p

    call json%get(me, path, p, found)

    if (present(found)) then
        if (.not. found) return
    else
        if (json%exception_thrown) return
    end if

    call json%get(p, vec)

    if (present(found) .and. json%exception_thrown) then
        call json%clear_exceptions()
        found = .false.
    end if

    end subroutine json_get_real_vec_by_path