Sign in Join
FPDoc Onlineexperiment

TJSONToYaml.Convert procedure

Member of TJSONToYamlpublicIn unit Json2Yaml

Convert JSON data to YAML format

Declaration

pascal
procedure Convert(JSON: TJSONData; aOutput: TStream)

Arguments

JSON

Source JSON data to convert

aOutput

Target stream for YAML output

Description

The Convert method converts the provided JSON data structure to YAML format and writes the result to the specified output stream. The method handles all JSON data types: objects, arrays, strings, numbers, booleans, and null values.

The conversion process uses the current IndentSize setting for proper YAML indentation. If AddHeader is True, a YAML document separator (---) is written at the beginning of the output.

Objects are converted to YAML mappings with key-value pairs, arrays become YAML sequences with list items prefixed by dashes, and scalar values are converted to their string representations.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.