Share via


Read and write YAML in AL using JsonObject

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

Business value

Data-driven testing often requires reading YAML test data, especially when testing Copilot features. Instead of creating a new YAML object model, you can use the extended JSON support to read YAML data into a JsonObject. You can manipulate the data as JSON with the JsonObject API and write it out as YAML if needed.

Feature details

The feature extends the existing JsonObject so you can read YAML into the JsonObject, manipulate it as JSON with the JsonObject API, and possibly write it out again as YAML.

The feature adds two new methods to read YAML into a JsonObject instance:

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

The feature adds two new methods to write a JsonObject instance as YAML:

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

Note

The feature is also backported to version 14.3 of the compiler, in 2024 release wave 2.

Geographic areas

Visit the Explore Feature Geography report for Microsoft Azure areas where this feature is planned or available.

Language availability

Visit the Explore Feature Language report for information on this feature's availability.

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.

Additional resources

JsonObject Data type (docs)