json_print_to_unit Subroutine

private subroutine json_print_to_unit(json, p, iunit)

Print the json_value structure to a file.

Arguments

Type IntentOptional AttributesName
class(json_core), intent(inout) :: json
type(json_value), intent(in), pointer:: p
integer(kind=IK), intent(in) :: iunit

the file unit (the file must already have been opened, can't be -1).


Contents

Source Code


Source Code

    subroutine json_print_to_unit(json,p,iunit)

    implicit none

    class(json_core),intent(inout)       :: json
    type(json_value),pointer,intent(in)  :: p
    integer(IK),intent(in)               :: iunit   !! the file unit (the file must
                                                    !! already have been opened, can't be -1).

    character(kind=CK,len=:),allocatable :: dummy !! dummy for `str` argument
                                                  !! to [[json_value_print]]

    if (iunit/=unit2str) then
        call json%json_value_print(p,iunit,str=dummy, indent=1_IK, colon=.true.)
    else
        call json%throw_exception('Error in json_print_to_unit: iunit must not be -1.')
    end if

    end subroutine json_print_to_unit