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).
— [email protected] | Multifarious, Inc. | http://mult.ifario.us/ On Mon, Dec 8, 2014 at 10:38 AM, Chris Riccomini < [email protected]> 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" <[email protected]> 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 > >
