Is there an easy way to write to stdout? I tried modifying the example:
program example2
use,intrinsic :: iso_fortran_env, only: wp => real64
use json_module
implicit none
type(json_core) :: json
type(json_value),pointer :: p, inp
! initialize the class
call json%initialize()
! initialize the structure:
call json%create_object(p,'')
! add an "inputs" object to the structure:
call json%create_object(inp,'inputs')
call json%add(p, inp) !add it to the root
! add some data to inputs:
call json%add(inp, 't0', 0.1_wp)
call json%add(inp, 'tf', 1.1_wp)
call json%add(inp, 'x0', 9999.0000d0)
call json%add(inp, 'integer_scalar', 787)
call json%add(inp, 'integer_array', [2,4,99])
call json%add(inp, 'names', ['aaa','bbb','ccc'])
call json%add(inp, 'logical_scalar', .true.)
call json%add(inp, 'logical_vector', [.true., .false., .true.])
! write the file:
call json%print()
end program example2
And get:
gfortran example.f90 -o hello -I /usr/local/Cellar/json-fortran/8.2.5/include/ /usr/local/Cellar/json-fortran/8.2.5/lib/libjsonfortran.a
example.f90:32:12:
32 | call json%print()
| 1
Error: Found no matching specific binding for the call to the GENERIC 'print' at (1)
Is there an easy way to write to stdout? I tried modifying the example:
And get: