Add a character string child to the json_value variable.
This routine is part of the public API that can be used to build a JSON structure using json_value pointers.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | p | |||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
character(kind=CK,len=*), | intent(in) | :: | val | value |
||
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_add_string(json, p, name, val, trim_str, adjustl_str)
implicit none
class(json_core),intent(inout) :: json
type(json_value),pointer :: p
character(kind=CK,len=*),intent(in) :: name !! name of the variable
character(kind=CK,len=*),intent(in) :: val !! value
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`
type(json_value),pointer :: var
!create the variable:
call json%create_string(var,val,name,trim_str,adjustl_str)
!add it:
call json%add(p, var)
end subroutine json_value_add_string