On Mon, Sep 10, 2018 at 2:23 PM Dallas Phillips
<dallasphillip...@gmail.com> wrote:
>
> The below example code describes my situation. I need to add the type 
> information to the serialization of a class. I have other classes that extend 
> this interface but that should not matter.
>
> I included a zip of the example code that I have for producing the error. 
> What I get is
>
> Caused by: com.fasterxml.jackson.core.JsonGenerationException: Can not start 
> an object, expecting field name (context: Object)
>     at 
> com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:1961)
>     at 
> com.fasterxml.jackson.core.json.JsonGeneratorImpl._reportCantWriteValueExpectName(JsonGeneratorImpl.java:244)
>     at 
> com.fasterxml.jackson.core.json.JsonGeneratorImpl._verifyPrettyValueWrite(JsonGeneratorImpl.java:234)
>     at 
> com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._verifyValueWrite(WriterBasedJsonGenerator.java:846)
>     at 
> com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeStartObject(WriterBasedJsonGenerator.java:260)
>     at 
> com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:151)
>     .....
>
> I am failing to find or discover what the error really is and why it is 
> trying to write a filed that I didn't specify as.

What would help is including:

1. Actual code you are using to trigger serialization (not just class
definitions)
2. Jackson version in use (and ideally first ensuring it's latest
patch of minor version you have)

As is just showing (some of) class declarations is unfortunately not
enough information to trigger this behavior.

-+ Tatu +-

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to