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