Code Wizards

OnSong® Binder File Format

OnSong® helped music teams ditch paper charts & sheet music, & ditch the binder too. No more 3-rings & hole punches, y’all. But like all tech progress, convenience brings new headaches. How do we move digital charts, sets & even books in an easy, cross-platform file format? Cue dramatic music. Enter OnSong® Binder.

What the Heck Is OnSong® Binder?

OnSong® Binder is a file format in OnSong 2026.2 & higher that wears the *.onsongbinder file extension & the “application/onsong-binder” MIME type. It’s just a ZIP file with a structured hierarchy of files & folders that lets you move all kinds of stuff around. Compress it, uncompress it, walk its contents, serialize & deserialize its objects, include data files. Freakin’ flexible. Let’s peek at some ways to build an OnSong® Binder file.

Where the Files Live

Gotta start somewhere, so we start at the root. These are the files or folders hangin’ out at the top of the data structure. Folders can be single objects or whole collections. Here’s how to tell them apart, y’all:

Folder structure of an example set binder: a manifest.json file & a songs folder with one folder per song, each hoarding its own manifest.json file & an attachments folder. ZOMG so organized.

Stuff

Objects live in a folder named after the object’s ID. Inside, you’ll find a “manifest.json” file. It’s JSON (JavaScript Object Notation), which both ends can turn into class-based objects. Magic!

Piles of Stuff

Collections are folders of folders, and each one holds object data via a “manifest.json” file. When an object has kids, those collections get their own folders named after the collection. A set, for instance, has a “songs” folder full of folders, one per song. Folders all the way down. LOL.

So with that big brain knowledge, your OnSong® Binder can hold one root object or a whole pile of ’em. Sending a setlist? Toss a “manifest.json” file at the root with the set info, then add a “songs” folder pointing to the objects in the setlist’s songs collection, each one a folder inside like this…

The Boss File

The manifest.json file is JSON, so it plays nice with practically everything. It stores all the junk needed to recreate the object on your end. Besides plain old name/value pairs, these binder-specific properties are up for grabs too:

$binder.ID

The object’s unique ID. It should match its folder name. Srsly, don’t mess this up.

$binder.class

This is the class name of the serialized object. Binding usually normalizes class names by ditching app-specific namespaces & prefixes. OnSong® uses a class called “OSBook”, but we simplify it to “Book”. Supported classes include “Set”, “Book”, “Song” & “SongAttachment”. Collect ’em all!

$binder.assembledOn

The ISO 8601 date/time when the object & binder got smooshed together. Nerds, rejoice.

$binder.collectionName

Most serialized objects have kids or relatives hangin’ on. A Set has songs in a specific order & a Song has attachments with files to display it different ways. The collection property is the name of the collection, like “$binder.songs”.

Whatever comes after the “$binder.” prefix in the property name is the name of the folder where those objects hang out. In this example, the Set folder holds a “songs” folder, which holds one file per song. The collection property points to the related item & its class, like so:

$binder.ref

It’s a URI pointing to the object, folder name & all. Fancy, amirite?

$binder.class

This is the object’s class name. Shocking, we know.

Say the Song object we’re pointing at has a unique ID of SONG_IDENTIFIER_1. It’d show up in the collection like this:

{“$binder.ref” : ”songs/SONG_IDENTIFIER_1”, “$binder.class” : ”Song”}

When processing this file, you may yank these keys out before using it in your own classes. We won’t tell. Promise.

Files

OnSong® Binder can also stash files. Handy if your object points to a binary or text file. A Song, for instance, can have a bunch of attachments full of viewable files. When the binder spots a property pointing to a file, it bundles that file right in. NOM NOM.

Take the SongAttachment object. It’s got a “filename” property pointing to a file, & this object class points to that file inside the main app. The binder assembly copies the file into the binding folder next to the attachment’s “manifest.json” in the Song’s folder. Then you find the attachment’s file with the “filename” property. Easy peasy.

Show & Tell

Yeah, that’s a lot to chew. But srsly, the OnSong® Binder format is super easy to implement. Best way to learn? Poke at the included examples for multiple songs, a single song, a set & a book, and see how OnSong handles each. Unzip ’em & snoop around: