json_clone Subroutine

public subroutine json_clone(from, to)

Arguments

Type IntentOptional AttributesName
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)

Description

Create a deep copy of a json_value linked-list structure.

Example

    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

Calls

proc~~json_clone~~CallsGraph proc~json_clone json_clone proc~json_value_clone_func json_value_clone_func proc~json_clone->proc~json_value_clone_func proc~json_value_clone_func->proc~json_value_clone_func
Help

Called By

proc~~json_clone~~CalledByGraph proc~json_clone json_clone proc~test_2 test_2 proc~test_2->proc~json_clone program~jf_test_2 jf_test_2 program~jf_test_2->proc~test_2
Help

Source Code

    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