There have been some comments on other entries here regarding JSON. JSON is a data interchange format, and is primarily used as a way to package data for use with Ajax development.
ColdFusion 8 (aka Scorpio) adds support for JSON in several ways:
- For starters, two new functions named SerializeJSON() and DeserializeJSON() make it easy to convert data to and from JSON. Simple variables (numbers and strings), dates, arrays, structures, and even queries can be converted back and forth. ColdFusion queries get converted into JSON objects with two entries, COLUMNS contains a list of columns, and DATA is an array of arrays containing the actual data.
- A supporting IsJSON() function does exactly what its name suggests.
- In addition, CFC methods can now be instructed to return data serialized as JSON by specifying returnformat=”json”. This is perfect for Ajax controls that invoke CFC methods to retrieve data.