Yes. Gold star! Although, the comma is meant to be there, to separate each object in the array, but the loop doesn't cater for the fact the last one in the loop, which doesn't need one. Not all browsers complain. But some do, so it's best avoided. The "printtowebasjsonarray" method of the documentfactory class shows how to get round it.
I just noticed another error in the code! The CStr( is missing a closing ) !!