Returns the json_value pointer given the path string.
It uses either of two methods:
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 |
subroutine json_get_by_path(json, me, path, p, found)
implicit none
class(json_core),intent(inout) :: json
type(json_value),pointer,intent(in) :: me !! a JSON linked list
character(kind=CK,len=*),intent(in) :: path !! path to the variable
type(json_value),pointer,intent(out) :: p !! pointer to the variable
!! specify by `path`
logical(LK),intent(out),optional :: found !! true if it was found
nullify(p)
if (.not. json%exception_thrown) then
! note: it can only be 1 or 2 (which was checked in initialize)
select case (json%path_mode)
case(1_IK)
call json%json_get_by_path_default(me, path, p, found)
case(2_IK)
call json%json_get_by_path_rfc6901(me, path, p, found)
end select
else
if (present(found)) found = .false.
end if
end subroutine json_get_by_path