A CFWheels plugin to allow you to store JSON data in your database fields.
Pull request Compare This branch is 7 commits ahead, 9 commits behind liferealized:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


CFWheels JSON Properties Plugin

The JSON properties plugin allows you to easily add structured data to a single database table field. You can easily store arrays and structures without the need for extra tables in your model.

The JSON properties plugin has a single initialization method that you must call in your model's init().

init Method

  • jsonProperty
    • property - the model property the serialize and deserialize when interacting with the database.
    • type - possible values include array or struct.
    • registerCallbacks - (defaults to true) Whether or not this plugin should automatically add the $deserializeJSONProperties and $serializeProperties callbacks. Set this to false if you want to invoke them or register them yourself.

Once you have initialized your model, there is no extra work required to start using the functionality of this plugin.

How to Use

Simply add structure data to your JSON property. That's it!

Interal Workings

The JSON proerties plugin works by adding callbacks to the initialized model to transparently serialize/deserialize complex data types into strings that can be stored in a database.

Callbacks Added

  • $deserializeJSONProperties is called on aferFind and afterSave
  • $serializeJSONProperties is called on beforeValidation and beforeDelete


This plugin was created by James Gibson and is now maintained by Chris Peters with support from Liquifusion Studios.


The MIT License (MIT)

Copyright (c) 2015 Liquifusion Studios