fortplot_spec_json_data Module

JSON data parsing: values arrays, row parsing, field scanning.

Handles parsing of Vega-Lite data objects including row-oriented JSON arrays with mixed numeric/string column types.



Functions

public pure function find_column(key, field_names, ncols) result(idx)

Find column index by field name

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key
character(len=64), intent(in) :: field_names(:)
integer, intent(in) :: ncols

Return Value integer


Subroutines

public subroutine parse_data(json, pos, d, status)

Parse data object: {"values": [{...}, ...]}

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
type(data_t), intent(out) :: d
integer, intent(out) :: status

public subroutine parse_values_array(json, pos, d, status)

Parse row-oriented data: [{"x":1,"y":2}, ...] Two-pass: first count rows and discover columns, then parse values.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
type(data_t), intent(out) :: d
integer, intent(out) :: status

public subroutine scan_row_fields(json, pos, field_names, field_is_string, nfields, status)

Scan one row object to discover field names and types. Advances pos past the entire row object.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
character(len=64), intent(inout) :: field_names(:)
logical, intent(inout) :: field_is_string(:)
integer, intent(inout) :: nfields
integer, intent(out) :: status

public subroutine parse_row(json, pos, d, row, field_names, ncols, status)

Parse one row object and store values into data columns

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
type(data_t), intent(inout) :: d
integer, intent(in) :: row
character(len=64), intent(in) :: field_names(:)
integer, intent(in) :: ncols
integer, intent(out) :: status

public subroutine parse_field_plot(json, pos, field, status)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
type(field_plot_t), intent(out) :: field
integer, intent(out) :: status

public subroutine parse_layers(json, pos, spec, status)

Parse layer array

Arguments

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

public subroutine parse_one_layer(json, pos, lay, status)

Parse a single layer object

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: json
integer, intent(inout) :: pos
type(layer_t), intent(out) :: lay
integer, intent(out) :: status