Simulation Core
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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