Load the JSON data from a file.
program main
use json_module
implicit none
type(json_file) :: f
call f%load('my_file.json')
!...
call f%destroy()
end program main
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_file), | intent(inout) | :: | me | |||
character(kind=CDK, len=*), | intent(in) | :: | filename |
the filename to open |
||
integer(kind=IK), | intent(in), | optional | :: | unit |
the unit number to use (if not present, a newunit is used) |
|
logical(kind=LK), | intent(in), | optional | :: | destroy_pointer |
destroy the pointer before loading (default is True) |
subroutine json_file_load(me, filename, unit, destroy_pointer) implicit none class(json_file),intent(inout) :: me character(kind=CDK,len=*),intent(in) :: filename !! the filename to open integer(IK),intent(in),optional :: unit !! the unit number to use !! (if not present, a newunit !! is used) logical(LK),intent(in),optional :: destroy_pointer !! destroy the pointer before !! loading (default is True) if (present(destroy_pointer)) then if (destroy_pointer) call me%destroy() else ! by default it is destroyed call me%destroy() end if call me%core%load(file=filename, p=me%p, unit=unit) end subroutine json_file_load