json_serializer Derived Type

type, public, extends(toml_visitor) :: json_serializer

Serializer to produduce a JSON document from a TOML datastructure


Components

Type Visibility Attributes Name Initial
type(json_ser_config), public :: config = json_ser_config()

Configuration for serializer

integer, public :: depth = 0

Current depth in the tree

character(len=:), public, allocatable :: output

Output string


Type-Bound Procedures

procedure, public :: visit

Visit a TOML value

  • private subroutine visit(self, val)

    Visit a TOML value

    Arguments

    Type IntentOptional Attributes Name
    class(json_serializer), intent(inout) :: self

    Instance of the JSON serializer

    class(toml_value), intent(inout) :: val

    TOML value to visit

Source Code

   type, extends(toml_visitor) :: json_serializer

      !> Output string
      character(len=:), allocatable :: output

      !> Configuration for serializer
      type(json_ser_config) :: config = json_ser_config()

      !> Current depth in the tree
      integer :: depth = 0

   contains

      !> Visit a TOML value
      procedure :: visit

   end type json_serializer