hsd-data Documentation

License

hsd-data is a multi-format structured data IO library for Fortran. It builds on hsd-fortran to provide unified loading and dumping of structured data in HSD, XML, JSON, YAML, TOML, and HDF5 formats.

Application code works exclusively with the familiar hsd_table / hsd_value tree from hsd-fortran — the backend handles all format-specific serialization.

Features

  • Unified APIdata_load / data_dump dispatch on format automatically (extension-based detection) or via explicit format constants.

  • Round-trip safe — loading from one format and dumping to another preserves structure, values, and attributes (within each format’s capabilities).

  • Built-in backends — HSD, XML (pure-Fortran pull parser + serializer), JSON (pure-Fortran recursive-descent parser + serializer), YAML (pure-Fortran parser + serializer). No external XML/JSON/YAML libraries required.

  • Optional backends — TOML (via toml-f), HDF5 (via HDF5 Fortran API).

  • CLI toolhsd-convert converts between any supported format pair.

Quick Start

program example
  use hsd_data
  implicit none

  type(hsd_table) :: root
  type(hsd_error_t), allocatable :: error

  ! Load from any supported format (auto-detected from extension)
  call data_load("input.hsd", root, error)
  if (allocated(error)) then
    call error%print()
    stop 1
  end if

  ! Dump to another format
  call data_dump(root, "output.json", error)

  ! Or use the high-level converter
  call data_convert("input.xml", "output.hsd", error)

end program example

Contents

Indices and tables