1 Reply Latest reply on Aug 25, 2017 3:26 AM by BKBK

    CF 2016: serializeJson dies on CFC with null values


      When serializing an object with a null or "undefined value" property (at least when it's a date), serializeJson dies trying to format the null date.


      '' is not a valid date/time format.



      component displayName="Order" accessors="true" {

           property name="orderNumber" type="string"

           property name="dateOrdered" type="date"





      var order = new Order();


      serializeJson(order);  // BOOM!



      In the past, null/undefined values would be excluded from the serialization -- and that's exactly what I want.


      Is this just the way it is now?! Or is there something else I can do?

        • 1. Re: CF 2016: serializeJson dies on CFC with null values
          BKBK Adobe Community Professional & MVP

          It should work. It did when I tested it.



          component displayName="Order" accessors="true" {

               // Note semicolons!

               property name="orderNumber" type="string";

               property name="dateOrdered" type="date";





          order = new order();





          When I run the above code in ColdFusion 2016, the result is: