# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Test/testJson.f90" program testjson use json_module use RedisInterface use iso_c_binding, only: c_null_char,c_char integer::n_children logical :: is_found character(len=:),allocatable::redisContent type(json_file) :: jsonfile type(json_value),pointer :: jsonvalue,p type(json_core) :: jsoncore,json character(len=:),allocatable::name ! call initConnection("config-remote.json") ! call getData(redisContent) ! print *,len(redisContent)," bytes read from redis" ! open(1,file="redisContent.json",status="REPLACE") ! write(1,"(A)") redisContent ! close(1) ! call jsoncore%initialize() ! call jsoncore%deserialize(jsonvalue,redisContent) ! ! call jsonfile%initialize() ! ! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop ! ! call jsonfile%json_file_get_root(jsonvalue) ! call jsoncore%info(jsonvalue, n_children=n_children) ! print *,"n_children =",n_children ! call jsoncore%info(jsonvalue, name=name) ! print *,"name = ",name call json%initialize(allow_duplicate_keys=.false.) call json%create_object(p,'') !create the root call json%add(p,'year',1805) !add some data call json%add(p,'year',2000) !add some data call json%add(p,'value',1.0) !add some data call json%print(p,'test.json') !write it to a file call json%destroy(p) !cleanup end program testjson