optimize array_to_json
DISTRPROF doesn't worck yet