completed json output function using simplejson