Unit 'Json2Yaml' Package
[Overview][Classes][Index] [#fcl]

TJSONToYaml.Convert

Convert JSON data to YAML format

Declaration

Source position: json2yaml.pp line 54

public procedure TJSONToYaml.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

AddHeader

  

Controls whether to add YAML document header

IndentSize

  

Number of spaces used for indentation


Documentation generated on: Mar 09 2026