Read and write YAML in AL using JsonObject

Important

Some of the functionality described in this release plan has not been released. Delivery timelines may change and projected functionality may not be released (see Microsoft policy). Learn more: What's new and planned

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Apr 2025 Apr 2025

Business value

When using data-driven testing, especially for testing Copilot features, there can be a need to read YAML test data. Rather than building an entirely new YAML object model, the existing JSON support is extended so that YAML can be read into the JsonObject, manipulated as JSON with the JsonObject API, and possibly written out again as YAML.

Feature details

The existing JsonObject is extended so that YAML can be read into the JsonObject, manipulated as JSON with the JsonObject API, and possibly written out again as YAML.

Two new methods are added to read YAML into a JsonObject instance:

[Ok :=] ReadFromYaml(String)
[Ok :=] ReadFromYaml(InStream)

Two new methods are added to write a JsonObject instance as YAML:

[Ok :=] WriteToYaml(String)
[Ok :=] WriteToYaml(OutStream)

Note

This was also backported to version 14.3 of the compiler, in 2024 release wave 2.

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.