Simulation Core
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

41 行
1.4 KiB

  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/Test/testJson.f90"
  2. program testjson
  3. use json_module
  4. use RedisInterface
  5. use iso_c_binding, only: c_null_char,c_char
  6. integer::n_children
  7. logical :: is_found
  8. character(len=:),allocatable::redisContent
  9. type(json_file) :: jsonfile
  10. type(json_value),pointer :: jsonvalue,p
  11. type(json_core) :: jsoncore,json
  12. character(len=:),allocatable::name
  13. ! call initConnection("config-remote.json")
  14. ! call getData(redisContent)
  15. ! print *,len(redisContent)," bytes read from redis"
  16. ! open(1,file="redisContent.json",status="REPLACE")
  17. ! write(1,"(A)") redisContent
  18. ! close(1)
  19. ! call jsoncore%initialize()
  20. ! call jsoncore%deserialize(jsonvalue,redisContent)
  21. ! ! call jsonfile%initialize()
  22. ! ! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop
  23. ! ! call jsonfile%json_file_get_root(jsonvalue)
  24. ! call jsoncore%info(jsonvalue, n_children=n_children)
  25. ! print *,"n_children =",n_children
  26. ! call jsoncore%info(jsonvalue, name=name)
  27. ! print *,"name = ",name
  28. call json%initialize(allow_duplicate_keys=.false.)
  29. call json%create_object(p,'') !create the root
  30. call json%add(p,'year',1805) !add some data
  31. call json%add(p,'year',2000) !add some data
  32. call json%add(p,'value',1.0) !add some data
  33. call json%print(p,'test.json') !write it to a file
  34. call json%destroy(p) !cleanup
  35. end program testjson