Change the json_value variable to a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | p | |||
character(kind=CK,len=*), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then '' is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
subroutine to_string(p,val,name)
implicit none
type(json_value),intent(inout) :: p
character(kind=CK,len=*),intent(in),optional :: val !! if the value is also to be set (if not present, then '' is used).
character(kind=CK,len=*),intent(in),optional :: name !! if the name is also to be changed.
!set type and value:
call destroy_json_data(p)
p%var_type = json_string
if (present(val)) then
p%str_value = val
else
p%str_value = '' !default value
end if
!name:
if (present(name)) p%name = trim(name)
end subroutine to_string