Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 1.02 KB

README.md

File metadata and controls

31 lines (27 loc) · 1.02 KB

cf-yaml-example

A CF/Lucee example of readding yaml file using jyaml.jar

Requirements

Load yaml.jar

// Load jyml.jar with JavaLoader
javaloader = createObject("component", "javaloader.JavaLoader").init( expandPath("./jyaml-1.3.jar") );
// Create jyml class
yaml = javaloader.create("org.ho.yaml.Yaml");

Read the yaml file

dataFile = createObject("java", "java.io.File").init( expandPath("./data.yml") );
data = yaml.load(dataFile);

Access the data structure with [ ] notation, the dot notation won't work

// This works
WriteDump( data["name"] );
// This will throw error
WriteDump( data.name );