You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by tom kersnick <hi...@gmail.com> on 2010/04/09 18:19:32 UTC

json to tab delimited

Gents,

What is the best way to turn a json log into a tab delimited file?

For instance:

{
  "method" : "GET",
  "status" : 200,
  "uri" : "/profiles/ef459f96-4ab6-4324-9d54-42ff41c01dcc/private",
  "eventClass" : "ResourceEvent",
  "responseTime" : 4,
  "instance" : "xxx.dev.dc1.xxx.com",
  "id" : "466a4377-f69e-41f0-9b51-fec32ece34bd",
  "timestamp" : 1270828340981,
  "category" : "private_profile_viewed",
  "producer" : "Profile",
  "correlationId" : null
}

to

GET    200    /profiles/ef459f96-4ab6-4324-9d54-42ff41c01dcc/private
ResourceEvent    4    xxx.dev.dc1.xxx.com
466a4377-f69e-41f0-9b51-fec32ece34bd    1270828340981
private_profile_viewed    Profile    null

I want to load this tab delimited format into Hive tables for our end
users.  I read through the Hive UDF and tried the get_json_object, but that
may not work for us at this time.  Any suggestions?

/tom

Re: json to tab delimited

Posted by Peter Sankauskas <pe...@motally.com>.
You can always use the JSON Serde that is in progress:
    http://code.google.com/p/hive-json-serde/

It only supports reading (not writing), but will work well for the example
you gave.

Kind regards,
Peter Sankauskas

Motally, Inc
Office: +1 (415) 932-6898


On Fri, Apr 9, 2010 at 9:19 AM, tom kersnick <hi...@gmail.com> wrote:

> Gents,
>
> What is the best way to turn a json log into a tab delimited file?
>
> For instance:
>
> {
>   "method" : "GET",
>   "status" : 200,
>   "uri" : "/profiles/ef459f96-4ab6-4324-9d54-42ff41c01dcc/private",
>   "eventClass" : "ResourceEvent",
>   "responseTime" : 4,
>   "instance" : "xxx.dev.dc1.xxx.com",
>   "id" : "466a4377-f69e-41f0-9b51-fec32ece34bd",
>   "timestamp" : 1270828340981,
>   "category" : "private_profile_viewed",
>   "producer" : "Profile",
>   "correlationId" : null
> }
>
> to
>
> GET    200    /profiles/ef459f96-4ab6-4324-9d54-42ff41c01dcc/private
> ResourceEvent    4    xxx.dev.dc1.xxx.com
> 466a4377-f69e-41f0-9b51-fec32ece34bd    1270828340981
> private_profile_viewed    Profile    null
>
> I want to load this tab delimited format into Hive tables for our end
> users.  I read through the Hive UDF and tried the get_json_object, but that
> may not work for us at this time.  Any suggestions?
>
> /tom
>