For me the same. I store the value as a string and the conversion is
carried out via Jackson 2.2.2 that does all the magic of
serialization/deserialization!
I store the json in a column named "value:json". For example this is my
map():

public void map(ImmutableBytesWritable row, Result columns, Context context)
throws IOException, InterruptedException {
for (KeyValue column : columns.list()) {
 final byte[] columnValue = column.getValue();
final byte[] columnFamily = column.getFamily();
final byte[] columnQualifier = column.getQualifier();
 final String family = Bytes.toString(columnFamily);
final String qual = Bytes.toString(columnQualifier);
 boolean isJsonColumn = "value".equals(family) && "json".equals(qual);
if (columnValue.length > 0 && isJsonColumn) {
                                String jsonString =
Bytes.toString(columnValue);
final ObjectMapper mapper = new ObjectMapper();
   MyObject myobj = mapper.readValue(jsonString, MyObject.class);
myobj.doSomething();
 }
}
}

Best,
Flavio

On Mon, Jul 15, 2013 at 2:52 PM, Ted Yu <[email protected]> wrote:

> What serialization / deserialization method did you use ?
>
> What HBase version are you using
>
> Thanks
>
> On Jul 15, 2013, at 1:08 AM, ch huang <[email protected]> wrote:
>
> > i want to store json into hbase ,but i store as key-value ,the struct is
> > destory,any good idea?
>

Reply via email to