Where are you trying to return the data to? And how big exactly is the string or json object you are trying to return?
You may need to set the max_allowed_packet global variable to be larger.
Stored procedures can return json scalar objects, which can be json arrays, but they can’t return actual SingleStore array objects directly back to the client app.
Another possible solution would be to break up your return value to a rowset of smaller values (assuming its a collection – have one row for each element of the collection) and let your client app concatenate the pieces back together.