samza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Riccomini <criccom...@linkedin.com.INVALID>
Subject Re: Having trouble deserializing nested json payload
Date Tue, 09 Dec 2014 16:37:07 GMT
Hey Paul,

We're on:

  jacksonVersion = "1.8.5"

The reason for this is to maintain compatibility with what YARN (Avro,
Jersey, hadoop-common) is depending on. If they upgrade, we will.


Cheers,
Chris

On 12/8/14 10:50 AM, "Paul Brown" <prb@mult.ifario.us> wrote:

>Hopefully you're on a more modern version of Jackson; the Codehaus version
>is ancient at this point with 2.4.4 being the latest (
>https://github.com/fasterxml/jackson).
>
>
>‹
>prb@mult.ifario.us | Multifarious, Inc. | http://mult.ifario.us/
>
>On Mon, Dec 8, 2014 at 10:38 AM, Chris Riccomini <
>criccomini@linkedin.com.invalid> wrote:
>
>> Hey Shekar,
>>
>> It sounds like you're mixing serializers. Samza's JSON (de)serializer is
>> implemented using Jackson:
>>
>>   http://jackson.codehaus.org/
>>
>> The JSONObject is part of org.json:
>>
>>   http://www.json.org/java/index.html
>>
>> These are two different implementations of a JSON serializer. You're
>> giving Jackson a JSONObject from the org.json implementation, and it
>> doesn't know how to serializer it. I'm sorry, but I'm not too familiar
>> with either GSON or org.json's JSON implementation, so I can't help much
>> beyond this.
>>
>> Cheers,
>> Chris
>>
>> On 12/8/14 2:53 AM, "Shekar Tippur" <ctippur@gmail.com> wrote:
>>
>> >I have a nested JSON as payload.
>> >
>> >For example,
>> >
>> >{
>> >
>> >  "source_ip": "1.2.3.4",
>> >
>> >"source_type":null,
>> >
>> >"creation_time":"1415296951",
>> >
>> >"criticality":"4",
>> >
>> >"raw":{"ACKNOWLEDGED":"false"}
>> >
>> >}
>> >
>> >
>> >I am using GSON to deserialize the payload.
>> >
>> >I am having trouble with the nested part.
>>"raw":{"ACKNOWLEDGED":"false"}
>> >
>> >In my gson structure, I was trying to define it as
>> >
>> >private JSONObject raw;
>> >
>> >But this seem to throw a exception -
>> >
>> > Exception in thread "ThreadJob"
>> >org.codehaus.jackson.map.JsonMappingException: No serializer found for
>> >class org.json.JSONObject and no properties discovered to create
>> >BeanSerializer (to avoid exception, disable
>> >SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference
>> >chain:
>> 
>>>java.util.HashMap["event"]->samza.examples.wikipedia.system.ArgosAlert["
>>>ra
>> >w"])
>> >
>> >Appreciate if someone could point out how to handle this.
>> >
>> >- Shekar
>>
>>


Mime
View raw message