Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | , | pointer | :: | from | this is the structure to clone |
|
type(json_value), | , | pointer | :: | to | the clone is put here (it must not already be associated) |
Create a deep copy of a json_value linked-list structure.
program test use json_module implicit none type(json_value),pointer :: j1, j2 call json_initialize() call json_parse('../files/inputs/test1.json',j1) call json_clone(j1,j2) !now have two independent copies call json_destroy(j1) !destroys j1, but j2 remains call json_print(j2,'j2.json') call json_destroy(j2) end program test
subroutine json_clone(from,to)
implicit none
type(json_value),pointer :: from !! this is the structure to clone
type(json_value),pointer :: to !! the clone is put here
!! (it must not already be associated)
!call the main function:
call json_value_clone_func(from,to)
end subroutine json_clone