Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | , | pointer | :: | me | ||
character(kind=CK,len=*), | intent(in) | :: | name | name of the variable |
||
integer(kind=IK), | intent(in), | dimension(:) | :: | val | value |
Add an integer vector to the structure.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(json_value), | public, | pointer | :: | var | |||
integer(kind=IK), | public | :: | i |
subroutine json_value_add_integer_vec(me, name, val)
implicit none
type(json_value),pointer :: me
character(kind=CK,len=*),intent(in) :: name !! name of the variable
integer(IK),dimension(:),intent(in) :: val !! value
type(json_value),pointer :: var
integer(IK) :: i !counter
!create the variable as an array:
call json_value_create(var)
call to_array(var,name)
!populate the array:
do i=1,size(val)
call json_add(var, '', val(i))
end do
!add it:
call json_add(me, var)
!cleanup:
nullify(var)
end subroutine json_value_add_integer_vec