Allocate a json_value pointer and make it a string variable. The pointer should not already be allocated.
type(json_value),pointer :: p
type(json_core) :: json
call json%create_string(p,'value','hello')
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | val | |||
character(kind=CK,len=*), | intent(in) | :: | name | |||
logical(kind=LK), | intent(in), | optional | :: | trim_str | if TRIM() should be called for the |
|
logical(kind=LK), | intent(in), | optional | :: | adjustl_str | if ADJUSTL() should be called for the |
subroutine json_value_create_string(json,p,val,name,trim_str,adjustl_str)
implicit none
class(json_core),intent(inout) :: json
type(json_value),pointer :: p
character(kind=CK,len=*),intent(in) :: val
character(kind=CK,len=*),intent(in) :: name
logical(LK),intent(in),optional :: trim_str !! if TRIM() should be called for the `val`
logical(LK),intent(in),optional :: adjustl_str !! if ADJUSTL() should be called for the `val`
call json_value_create(p)
call json%to_string(p,val,name,trim_str,adjustl_str)
end subroutine json_value_create_string