Assignment operator for character = json_core. This is just a wrapper for the json_value_to_string routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(kind=CK,len=:), | intent(out), | allocatable | :: | str | ||
class(json_file), | intent(in) | :: | me |
subroutine assign_json_file_to_string(str,me)
implicit none
character(kind=CK,len=:),allocatable,intent(out) :: str
class(json_file),intent(in) :: me
type(json_core) :: core_copy !! a copy of `core` from `me`
if (me%core%failed() .or. .not. associated(me%p)) then
str = ''
else
! This is sort of a hack. Since `me` has to have `intent(in)`
! for the assignment to work, we need to make a copy of `me%core`
! so we can call the low level routine (since it needs it to
! be `intent(inout)`) because it's possible for this
! function to raise an exception.
core_copy = me%core ! copy the parser settings
call core_copy%serialize(me%p,str)
if (me%core%failed()) str = ''
end if
end subroutine assign_json_file_to_string