Language Enhancements in ColdFusion Splendor – Improved JSON serialization 2

In the previous post, I blogged about JSON serialization enhancements and covered a couple of
features around it. This post, a continuation from the last one, will cover the remaining features added in ColdFusion Splendor to serialize a ColdFusion object better. Before going into the details of the remaining improvements, here is the complete list of JSON features.

  • Data type preservation for Query and CFC 
  • Case preservation of struct keys
  • Added “Struct” as new QueryFormat
  • Custom serializer

Added “Struct” as new QueryFormat

In ColdFusion, Row and column are the supported types to serialize a query object. However, none of these two formats are fit for the jQuery type JavaScript framework. These JavaScript frameworks work well with column-value (like struct) format and to facilitate easy integration with these frameworks, a new query format “struct” has been introduced in ColdFusion Splendor. So, starting from Splendor, 3 different format types rowcolumn, and struct are now supported to serialize a query object to a JSON string. For example, to serialize a query object with 3 rows and 2 columns (colour,id), the serialized JSON string for row and struct query format will look like:

row  format:   {“ROWCOUNT”:3, “COLUMNS”:[“COLOUR”, “ID”], DATA:{“colour”: [“red”, “green”, “blue”], “id”: [1,2,3]}}

struct format:  [{“colour”:”red”, “id”:1}, {“colour”:”green”, “id”:2}, {“colour”:”blue”, “id”:3}]

As you can notice, the struct format is based on the key-value pair and is quite simple. The only downside of this format is the repetition of the column names. Here, the column names are repeated for each and every row.

Custom serializer

ColdFusion Splendor has enhanced JSON serialization support to help you hook your own custom serializer for serializing a ColdFusion object. The custom serializer enables you to register your own handler for serializing and deserializing the complex object. If the serializer is not specified, ColdFusion will use the in-built serialization handler.

Steps to use the custom serializer: There are two steps involved to hook a custom serializer in ColdFusion.

 1. Implement the custom serializer:  The customSerializer handler, a CFC, has four functions for you to implement.

  1. canSerialize
  2. serialize
  3. canDeserialize
  4. deserialize
 2. Register the handler:  Handler needs to be registered by adding its entry to application.cfc as following:
Application.cfc
<cfset this.customSerializer="MyCustomSerializer" />

This custom serializer has been explained in great details in ColdFusion Documentation

 

Language Enhancements in ColdFusion Splendor – Improved JSON serialization

I started a series of blog posts on language enhancements and so far covered Script support for tags and Member functions. Today, I will be blogging about the new features added in ColdFusion Splendor to improve JSON serialization.
Before I dive into the details of JSON serialization enhancements, here is the
list of the language features:

JSON serialization was first introduced in ColdFusion 8 and we constantly worked on improving this feature continously over the past several ColdFusion versions.

The complete list of JSON-level enhancements added to ColdFusion Splendor are:

  1. Data type preservation for Query and CFC 
  2. Case preservation of struct keys
  3. Added “Struct” as new QueryFormat
  4. Custom serializer
Data type preservation for Query and CFC
It has always been a challenge to rightly identify the underlying data type of a CFC property or of a column data of a query object. Prior to Splendor, ColdFusion used to check whether a data type can be converted to a number or boolean. If it can be converted, ColdFusion will automatically convert the property value to number/boolean irrespective of whether the property values needs conversion. Starting from Splendor, the metadata of the query, retrieved from the underlying database, will be used to identify the right data type of a column and the column data will be serialized based on that. Similarly, for a CFC, the CFC metadata will be retrieved and used to detect the right data type of the CFC property to serialize into.
Entity.cfc
 <cfcomponent persistent="true" table="partners" ... >
     <cfproperty name='zipcode' type="string" />
</cfcomponent>
index.cfm
   <cfscript>
        t = createObject("component", "Entity");
        t.setData("01003");
        writeoutput(serializeJSON(t));
   </cfscript>  


CF10 output      : {“zipcode”: 1003}
Splendor output : {“zipcode”: “01003”}

In the above example, unlike in ColdFusion10, the zipcode value is serialized as a string  and not as a number. Though the value looks like a numeric one, it will not be serialized as a number rather the data type information is retrieved from the underlying CFC metadata and  will be used to serialize it. 

Case preservation of struct keys

Prior to Splendor, ColdFusion did not preserve the case of a struct key but it converted it to the uppercase. Starting from Splendor, ColdFusion will preserve the original case of the struct key in which it is defined. But in case if you want to go back to the old ColdFusion behavior, you can use either the application setting or ColdFusion Administrator setting to switch back to the old behavior.  The following code will help you understand how this behavior works in ColdFusion10 and now:

<cfscript>
   data = {};
   data.empName ="John";
   data.age = 21;
   writeoutput(serialize(data));
</cfscript> 

Output in ColdFusion10   : {‘EMPNAME’= ‘John’, ‘AGE’=21}
Output in Splendor          :  {’empName ‘= ‘John’, ‘age’=21}

To keep this post short, I will be blogging the remaining JSON features in a separate post. Please refer the ColdFusion Splender public beta documentation for more details on JSON enhancement.   


Public Beta for ColdFusion and ColdFusion Builder is now available!

In case you haven’t already noticed,the public beta for the major version of ColdFusion codenamed Splendor and for the next major version of ColdFusion Builder Thunder is now available.

Here is where you can get access to the public beta for both the products on Adobe Labs – http://labs.adobe.com/technologies/coldfusion/

You can quickly go over what’s new in ColdFusion Splendor here. There are also a couple of videos on the video tab that gives you a quick introduction to what’s new in ColdFusion. The link for the documentation home page is at – https://wikidocs.adobe.com/wiki/display/coldfusionen/Home

There are lots of new features and enhancements in Splendor and in Thunder. We look forward to hearing your feedback during the public beta.

 

 

 

 

Amazon Web Services Webinar – Leverage the power of Adobe ColdFusion on AWS

Amazon is organizing a webinar on the 18th of September at 10 am PT titled ‘Leverage the power of Adobe ColdFusion on AWS’. You can register for this AWS webinar here

Learn about the AWS offering from,

Tom Laszewski, Solutions Architect, Amazon Web Services

Chandan Kumar, Computer Scientist, Adobe

Akhila K. Srinivas, Software Engineer, Adobe

 

ColdFusion Feature Usage Survey

Please participate in this ColdFusion feature usage survey. This is not a typical feature usage survey for ColdFusion. The purpose of this survey is to understand the usage of some of the old or not-so-popular features of ColdFusion.

The information gathered here will help Adobe deprecate/retain/provide alternate features in the next major version of ColdFusion.

Thanks for your time.

ColdFusion 10 update 11 – An update with 50+ fixes

ColdFusion 10 update 11 is now available for download within the ColdFusion 10 administrator. This is a significant update as it has more than 50 fixes across various areas of the product.

The most noteworthy additions are the support for Microsoft SQL Server 2012, MySQL 5.6 and 64-bit COM interoperability.

Here are the key areas and some fixes made in this update:

1. JSON – serialization issues 

2. Caching – ORM secondary cache and cached query with query params, 

3. File Management – Spreadsheet tag working with VFS files

4. Hotfix Installer – Error notification if a problem is encountered during hotfix installation

5. REST Services – Issues with RestInitApplication

6. Scheduler – onMisfire event handler, PauseAll/ResumeAll, Scheduled tasks – migrated or from CAR

7. Security – Accesing public methods of a CFC via WebSockets

8. Web Container/Tomcat – CGI.server_port, IIS custom error handlers

9. Web Services – IIS virtual folders and https access

10. WebSocket – CGI scope reset and CFC returning CGI Scope

Details of each of the fixes in update 11 is available in here.

 

ColdFusion – Clarification to David Wadhwani’s comment

David’s comment on the TechCrunch article about Enterprise developers and backend tools is not targeted at ColdFusion, but towards other products that Adobe announced in 2011

There has been no reduction in investments in ColdFusion over last few years. We see exciting opportunities driving the future of ColdFusion and we will continue to make investments that the opportunities demand or need. 

 

 

IDC Whitepaper on Adobe ColdFusion – Turning up the heat with ColdFusion

A new whitepaper from IDC on ColdFusion is now available within the ColdFusion Community Portal (Details of the portal here). The whitepaper from the analyst descirbes the value proposition of ColdFusion, powerful capabilities of the platform, future directions and customer case studies.

 

 

Announcing the new ColdFusion Community Portal

 

Here’s the all new ColdFusion Community portal launched by Adobe : http://coldfusion.adobe.com

The community portal is one centralized access point for information on the latest in ColdFusion. It also provides our partners and consultants to showcase their capabilities and latest innovations with the platform. It is also a User Group hub where ColdFusion developers can find information related to various User Groups and their events.

We are pleased to announce the launch of ColdFusion Community portal with the aim to make it a go-to place for the ColdFusion community. The idea is to integrate ColdFusion content created not just by the product team at Adobe, but also by our partners and you the community. We believe such content will be of immense use to everyone in the ColdFusion community. 

Please go through the portal and let us know how we can further improve it. You can send an email with your inputs/comments to Kishore Balakrishnan kishore@adobe.com , Marketing Manager for ColdFusion.

The portal is built using the popular Mura CMS! 

 

Pre-release for ColdFusion Splendor

Here’s some exciting news about ColdFusion Splendor. We will soon have pre-release open for Adobe ColdFusion Splendor, next major version of ColdFusion server and ColdFusion Builder Thunder, next major version of ColdFusion Builder. This time we will have a single pre-release program for both Builder and Server. 

If you are interested in being a part of the pre-release, do take this survey linked here.

Please realize that participating in this survey does not guarantee a pre-release invite. The plan is to start the pre-release with a reduced number of participants and eventually increase the number of pre-release of participants. You will receive an invite as soon as your interest is accepted. The acceptance may happen now or in the coming months when we decide to increase the number of pre-release participants.

Your participation will be valuable in shaping up the future version of ColdFusion.