Table of Contents

Prototype: parseyaml(yaml_data)

Return type: data

Description: Parses YAML data directly from an inlined string and returns the result as a data variable


  • yaml_data: string - JSON string to parse - in the range: .*

Please note that it's usually most convenient to use single quotes for the string (CFEngine allows both types of quotes around a string).




      data =>  parseyaml('
    - arrayentry1
    - arrayentry2
    - key1: 1
      key2: 2

      # inline syntax since 3.7
      # note the --- preamble is required with inline data

      data =>  '---
    - arrayentry1
    - arrayentry2
    - key1: 1
      key2: 2

See also: readjson(), readyaml(), mergedata(), Inline YAML and JSON data, and data documentation.