Skip to content

Example of parsing YAML file into Coldfusion/Lucee, using jyaml and JavaLoader

License

Notifications You must be signed in to change notification settings

tomysaman/cf-yaml-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 );

About

Example of parsing YAML file into Coldfusion/Lucee, using jyaml and JavaLoader

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published