Recursive function for converting arrays to lists and tuples into dash-joined keys for JSON serialization.