fortplot_spec_json Module

JSON serialization for spec_t -> Vega-Lite JSON Produces valid Vega-Lite v5 JSON from Fortran spec_t types. Row-oriented output: data.values is an array of objects.



Functions

public pure function escape_json_string(s) result(escaped)

Escape a string for safe JSON embedding. Handles: " -> \", \ -> \, and control characters.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s

Return Value character(len=:), allocatable

public function spec_to_json(spec) result(json)

Serialize spec_t to a Vega-Lite JSON string

Arguments

Type IntentOptional Attributes Name
type(spec_t), intent(in) :: spec

Return Value character(len=:), allocatable


Subroutines

public subroutine spec_to_json_file(spec, filename, status)

Write spec_t as Vega-Lite JSON to a file

Arguments

Type IntentOptional Attributes Name
type(spec_t), intent(in) :: spec
character(len=*), intent(in) :: filename
integer, intent(out) :: status