Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout), | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CK,len=*), | intent(in) | :: | val | value |
Add a character string child to the json_value variable.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(json_value), | public, | pointer | :: | var | |||
character(kind=CK,len=:), | public, | allocatable | :: | str |
subroutine json_value_add_string(me, name, val)
implicit none
type(json_value),pointer :: me
character(kind=CK,len=*),intent(in) :: name !! name of the variable
character(kind=CK,len=*),intent(in) :: val !! value
type(json_value),pointer :: var
character(kind=CK,len=:),allocatable :: str
!add escape characters if necessary:
call escape_string(val, str)
!create the variable:
call json_value_create(var)
call to_string(var,str,name)
!add it:
call json_add(me, var)
!cleanup:
nullify(var)
end subroutine json_value_add_string