providence
providence

Reputation: 29463

Ruby object to Java object

I want to create an object from a Ruby program and store it in an SQL database as a blob. I then want to be able to read this blob directly into a Java program at a later date. I understand that these blobs will probably be incompatible. How can I go about making a Java-readable blob from Ruby?

Upvotes: 1

Views: 809

Answers (3)

Joshua Partogi
Joshua Partogi

Reputation: 16435

You should use thrift, it is much faster than (de)serializing json. See the benchmark here

Upvotes: 0

zengr
zengr

Reputation: 38899

  1. Serialize ruby object to YAML (or JSON, XML etc)
  2. Save it in the DB
  3. Deserialize it from YAML to Java object

Upvotes: 2

Mikita Belahlazau
Mikita Belahlazau

Reputation: 15434

You can use json (xml, yaml) format to store object as string. And parse it in java.

Upvotes: 2

Related Questions