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 |
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 json_value_add_string(json, p, name, val)
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
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%create_string(var,str,name)
!add it:
call json%add(p, var)
end subroutine json_value_add_string