Class YamlTemplateHelper
java.lang.Object
org.mockserver.templates.engine.helpers.YamlTemplateHelper
YAML helpers for templates: convert YAML to JSON and read a field out of a
YAML document. Backed by Jackson's YAML dataformat (already on the classpath
via
YamlToJsonConverter).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReads a top-level field from a YAML document and returns its value as a string (scalars are returned verbatim, objects/arrays as JSON).Converts a YAML document to its JSON representation.toString()
-
Constructor Details
-
YamlTemplateHelper
public YamlTemplateHelper()
-
-
Method Details
-
toJson
Converts a YAML document to its JSON representation. Returns an empty string fornullor empty input, and the original input if it cannot be parsed as YAML. -
parse
Reads a top-level field from a YAML document and returns its value as a string (scalars are returned verbatim, objects/arrays as JSON). Returns an empty string when the field is absent or the input cannot be parsed. -
toString
-