zohar
zohar

Reputation: 2378

Hadoop: How to save Map object in configuration

Any idea how can I set Map object into org.apache.hadoop.conf.Configuration?

Upvotes: 3

Views: 1605

Answers (1)

Thomas Jungblut
Thomas Jungblut

Reputation: 20969

Serialize your map into JSON and then put it as string in your configuration. There is no way to put a whole object into it, because the whole configuration will be written as a XML file.

GSON is quite good at it: http://code.google.com/p/google-gson/ Here is the tutorial about how to serialize collections: http://sites.google.com/site/gson/gson-user-guide#TOC-Collections-Examples

Upvotes: 5

Related Questions