7 Replies Latest reply: Apr 26, 2012 12:38 AM by BKBK RSS

    Problem with serializeJSON -- truncates embedded objects

    David Aden Community Member

      It appears that serializeJSON will truncate embedded arrays of objects. This came up while refactoring an ajax app and it took a while to trace down as I thought I must have done something wrong in refactoring somewhere.


      I eventually found out that the implicit serialization that was being done by a "remote" method of an object that has a property containing an array of other objects seems to truncate anything more than the first two elements of the embedded array.


      Here are some files that demonstrate the problem running the dev version 9.01 on a Windows 7 desktop.


      Index.cfm generates an array of objects, then adds the array to a property of ttl_message object and serializes both the array itself (which works fine) and the ttl_message object (which results in the first two elements of the embedded array being serialized but the second two being set to "").




      component {







                this.ormEnabled = false;





      component ttl_Assignment


                persistent="false" {


                property string name;


        property string description;


                function init( obj ) {

                          if( IsDefined("obj") ) {

                                    for( var p in obj) {

                                              variables[p] = obj[p];









      component ttl_Message


                persistent="false"   {


                property string name;


          property any payload;



                public any function init( string name){

                          if( isStruct( "name" ) ) {


                          } else {

                                    setName( name );



                          return this;







                // make some new assignments

                a = new ttl_Assignment( {"name"="foo","description"="descript here"} );

                b = new ttl_Assignment( {"name"="boo","description"="descript 2"} );

                c = new ttl_Assignment( {"name"="boo","description"="descript 3"} );

                d = new ttl_Assignment( {"name"="boo","description"="descript 4"} );


                // put them into an array

                arr = [a,b,c,d];


                // create a message

                mess = new ttl_Message( "here is the message" );


                // add the array to the message

                mess.setPayload( arr );


                writedump( arr );                                                            // dump the array

                writedump( serializeJSON(arr) );                    // serialize the array

                writedump( mess );                                                            // dump the message

                writedump( serializeJSON(mess) );                    // serialize the message