json_value_remove_if_present Subroutine

private subroutine json_value_remove_if_present(json, p, path)

Given the path string, remove the variable from json_value, if it exists.


Type IntentOptional AttributesName
class(json_core), intent(inout) :: json
type(json_value), pointer:: p
character(kind=CK,len=*), intent(in) :: path

the path to the variable to remove


Source Code

    subroutine json_value_remove_if_present(json,p,path)

    implicit none

    class(json_core),intent(inout)      :: json
    type(json_value),pointer            :: p
    character(kind=CK,len=*),intent(in) :: path  !! the path to the variable to remove

    type(json_value),pointer :: p_var
    logical(LK) :: found

    call json%get(p,path,p_var,found)
    if (found) call json%remove(p_var)

    end subroutine json_value_remove_if_present