generate jSon objects (not all arrays) and some cleanup of the outpout