a large array
What do you mean by "large"? 100 elements? 10 000? 1 000 000? Also: What's the content of your array? Does it contain mixed types? Strings? Integers? Floats?
I tried using
to_json but it's pretty inefficient
Define "pretty inefficient". If you send the string representation of a huge array, it will take time, yes. However, there's no magic solution for this. Depending on your use case, you might get away with sending the string in smaller chunks. The real question is why you have to send a huge array over the network in the first place though...