Modularized object to JSON code. Added a way to handle errors.
convert array of custom objects to json
added fast version of array to json where all objects in array are same type saving us from looking up the properties.