String that you get from struct.to_s is made for inspection only. To transfer your struct you will need to serialize it on the one side and deserialize it from the other side. There are a variety of formats including JSON, YAML and Marshal. The last one produces non human-readable byte streams but it is the most easy to use:
Person = Struct.new(:first_name, :last_name)
me = Person.new("Semyon", "Perepelitsa")
p data = Marshal.dump(me)
"\x04\bS:\vPerson\a:\x0Ffirst_nameI\"\vSemyon\x06:\x06ET:\x0Elast_nameI\"\x10Perepelitsa\x06;\aT"
# on the other side
p Marshal.load(data)
#<struct Person first_name="Semyon", last_name="Perepelitsa">