convert an array of custom object to json format string