Simple Deserialization utility in Ruby.

Hi Guys

I'm new to Ruby and wondering if there is a deserialization utility in
Ruby similar to Java's Google GSON library.

When we use Google GSON, there is no need to define custom deserializer or
define in the model class that we want this to be serializable etc.

I posted more details here:

For instance, in Java using Google GSON, we can accomplish conversion of
String (Json object) to custom Java object .

*Address address=gson.fromJson(addressJsonStringForm, Address.class);*
Thanks in advance.

Regards
Vineel

Have you tried JSON.parse for this?

Walter

···

On Dec 22, 2018, at 4:18 PM, Vineel Yalamarthi <vineelyalamarthi@gmail.com> wrote:

Hi Guys

I'm new to Ruby and wondering if there is a deserialization utility in Ruby similar to Java's Google GSON library.

When we use Google GSON, there is no need to define custom deserializer or define in the model class that we want this to be serializable etc.

I posted more details here:
JSON Deserialization in Ruby - Stack Overflow

For instance, in Java using Google GSON, we can accomplish conversion of String (Json object) to custom Java object .

Address address=gson.fromJson(addressJsonStringForm, Address.class);

Thanks in advance.

Regards
Vineel

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

There are a number of serialisers/deserialisers available actually:

* Marshal, in core: Module: Marshal (Ruby 2.5.3)
* YAML, in the stdlib: Module: YAML (Ruby 2.5.3)
* JSON, in the stdlib: Module: JSON (Ruby 2.5.3)

Marshal and YAML can directly (de)serialise Ruby objects, within certain
restrictions. For instance, you cannot serialise File instances as they
refer to an open file descriptor under the hood.

Marvin

···

Am 22. Dezember 2018 um 13:18 Uhr -0800 schrieb Vineel Yalamarthi:

Hi Guys

I'm new to Ruby and wondering if there is a deserialization utility in
Ruby similar to Java's Google GSON library.

--
Blog: https://mg.guelker.eu
PGP/GPG ID: F1D8799FBCC8BC4F