I have a YAML file in my directory and I want to validate the YAML file was in correct structure using java programming. In online it having lot of YAML checker but I want to validate that on java programming.
How could I validate a YAML structure in java programming
Just try to load it with your YAML parser/library. If that throws an error catch it and the structure is invalid. That is the way the online parsers work as well.
You can use YAML parser/librairies like Jackson or SnakeYAML:
There's also https://github.com/EsotericSoftware/yamlbeans
One issue I've found is that JSON objects are acceptable YAML 1.2 and, arguably, 1.1 formats.
© 2022 - 2024 — McMap. All rights reserved.
null
in the created POJO/bean (without creating an error). What I said at least applies to snakeyaml. There might be more feature-rich parsers. – Assonance