Print the JSON structure to the specified filename. The file is opened, printed, and then closed.
Example loading a JSON file, changing a value, and then printing result to a new file:
type(json_file) :: f
logical :: found
call f%load('my_file.json') !open the original file
call f%update('version',4,found) !change the value of a variable
call f%print('my_file_2.json') !save file as new name
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_file), | intent(inout) | :: | me | |||
character(kind=CDK,len=*), | intent(in) | :: | filename | filename to print to |
subroutine json_file_print_to_filename(me,filename)
implicit none
class(json_file),intent(inout) :: me
character(kind=CDK,len=*),intent(in) :: filename !! filename to print to
call me%core%print(me%p,filename)
end subroutine json_file_print_to_filename