Thursday, August 27, 2015

ColdFusion UDF ( JSONUtil ) for serialize complex Objects without changing data formatting

ColdFusion has built-in function  SerializeJSON for serialize a complex object into JSON but many times our data gets converted into some different format. Example:

- if a number is greater than certain limit then it will convert it into exponent format.
- if the data type is date then it converted to some type but in UI side we want something different.
- Sometimes decimal fields also gets converted to some other formatting.


So, in-order to avoid any reformatting of data at client side. I wrote a ColdFusion function which will perform the conversion (CF Object -> JSON). I'm already using this in one of my project and it works fine without any problem. Hope it may help you if you're looking something like this.

Points to Remember:
- You can modify the code if you need certain type of formatting for date or number data type.
- For serializing ColdFusion components make sure the fields present as the properties of that component.

If you have any feedback for this I'm happy to listen it. Below is the code:

3 comments:

  1. At Silicon IT Hub, we have team of professional website developers that looks after your web appearance and functionalities. We have developers that are well versed with Cold Fusion Development and we help you in designing a website that is fully functional and highly speedy. We can help you with cost-effective and highly secured website applications at our desk.

    ReplyDelete
  2. Did you hear there is a 12 word sentence you can speak to your partner... that will trigger deep feelings of love and impulsive appeal for you deep within his heart?

    That's because hidden in these 12 words is a "secret signal" that triggers a man's impulse to love, idolize and protect you with all his heart...

    ====> 12 Words That Trigger A Man's Desire Response

    This impulse is so built-in to a man's genetics that it will make him try harder than ever before to take care of you.

    Matter-of-fact, triggering this mighty impulse is absolutely mandatory to having the best possible relationship with your man that the instance you send your man a "Secret Signal"...

    ...You will immediately find him open his heart and soul to you in a way he haven't experienced before and he'll recognize you as the only woman in the universe who has ever truly understood him.

    ReplyDelete

Followers