toml_serialize Function

public function toml_serialize(val, config) result(string)

Serialize a JSON value to a string and return it.

In case of an error this function will invoke an error stop.

Arguments

Type IntentOptional Attributes Name
class(toml_value), intent(inout) :: val

TOML value to visit

type(toml_ser_config), intent(in), optional :: config

Configuration for serializer

Return Value character(len=:), allocatable

Serialized JSON value


Source Code

function toml_serialize(val, config) result(string)
   !> TOML value to visit
   class(toml_value), intent(inout) :: val

   !> Configuration for serializer
   type(toml_ser_config), intent(in), optional :: config

   !> Serialized JSON value
   character(len=:), allocatable :: string

   type(toml_error), allocatable :: error

   call toml_dumps(val, string, error, config=config)
   if (allocated(error)) then
      error stop error%message
   end if
end function toml_serialize