How could I validate a YAML structure in java programming

Karthikeyan Velmurugan picture Karthikeyan Velmurugan · Oct 7, 2015 · Viewed 7.6k times · Source

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.

Answer

Anthon picture Anthon · Oct 7, 2015

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.