Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | me | |||
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. |
Change the json_value variable to a string.
subroutine to_string(me,val,name)
implicit none
type(json_value),intent(inout) :: me
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(me)
me%var_type = json_string
if (present(val)) then
me%str_value = val
else
me%str_value = '' !default value
end if
!name:
if (present(name)) me%name = trim(name)
end subroutine to_string