fix output so json_encode doesn't break the compare arrays
sort the associative array