Thank you! I was hitting 2^31 byte limit before I SHAPE annotation but have squeezed past that now. Will see what 'MINIMAL_CLASS' does.
On Monday, November 27, 2017 at 1:33:00 PM UTC-7, Tatu Saloranta wrote: > > On Mon, Nov 27, 2017 at 12:02 PM, Rob Sargent <[email protected] > <javascript:>> wrote: > > I'm wondering if I can reduce the array structure any further, from > > [[classname,[comma, separated, values] [classname,[comma, separated, > > values]] > > to [classname[comma, separated, values] [comma, separated, values]] > > > > Thanks for any pointers. > > That is about as compact as default handlers allow, with one minor > difference: you could use `MINIMAL_CLASS` > instead of `CLASS` to likely further reduce class name portion. > There is no out-of-the-box mechanism for associating polymorphic type > to container, however; for that you would > need custom deserializer (or perhaps in theory custom `TypeSerializer` > / `TypeDeserializer`, but probably not worth > the hassle over custom (de)serializer. > > So I would probably just write custom `JsonSerializer` / > `JsonDeserializer` pair if compactness is very important. > > -+ Tatu +- > > > > > I'm using an ObjectMapper defined as: > > private ObjectMapper getObjectMapper() { > > if (objectMapper == null) { > > objectMapper = new ObjectMapper(); > > objectMapper.configure(SerializationFeature.INDENT_OUTPUT, > > false); > > > objectMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, > > false); > > > > //objectmapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, > false); > > objectMapper.setSerializationInclusion(Include.NON_NULL); > > } > > return objectMapper; > > } > > > > > > And the pojos are annotated as > > @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, > include=JsonTypeInfo.As.PROPERTY, > > property="class") > > @JsonTypeName("edu.utah.camplab.db.generated.base.tables.pojos.Alias") > > @JsonFormat(shape=JsonFormat.Shape.ARRAY) > > @JsonPropertyOrder(alphabetic=true) > > public class Segment implements Serializable { > > ... > > > > > > The overall payload for these segments is > > public class SegmentBlock { > > private Map<String, Segmentset> segmentsetMap = null; > > private Map<String, List<Segment>> segmentMap = null; > > > > public SegmentBlock() { } > > ... > > > > > > The Map<String, List<Segment>> shows up as: > > > "101869,104285,107387,113264,30755,32213,84261,86148,87462,89260,89343":[ > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,337017,1,0,4,19,null,46,null,null,293562]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,774193,0,1,4,111,null,144,null,null,677629]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,822967,0,1,4,146,null,170,null,null,774709]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,2035907,0,0,5,438,null,459,null,null,1997064]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,2231210,2,0,3,485,null,507,null,null,2120487]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,3614445,0,0,5,709,null,730,null,null,3509056]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,3718848,1,1,3,735,null,756,null,null,3639782]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,4704467,0,1,4,854,null,885,null,null,4431105]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,7926627,0,0,5,1528,null,1548,null,null,7781460]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,66292957,0,0,5,6422,null,6441,null,null,66107705]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,70676534,0,0,5,6815,null,6839,null,null,70500809]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,77370138,0,0,5,7593,null,7623,null,null,77302778]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,78660658,0,0,5,7835,null,7857,null,null,78509079]], > > > > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[16,88970818,0,0,5,9977,null,10003,null,null,88872145]]] > > > > > > Is there any way to get the above back as something like: > > > > > "101869,104285,107387,113264,30755,32213,84261,86148,87462,89260,89343":[ > > ["e.u.c.db.generated.default_schema.tables.pojos.Segment",[ > > [16,337017,1,0,4,19,null,46,null,null,293562], > > ,[16,774193,0,1,4,111,null,144,null,null,677629], > > ,[16,822967,0,1,4,146,null,170,null,null,774709], > > ,[16,2035907,0,0,5,438,null,459,null,null,1997064], > > ,[16,2231210,2,0,3,485,null,507,null,null,2120487], > > ,[16,3614445,0,0,5,709,null,730,null,null,3509056], > > ,[16,3718848,1,1,3,735,null,756,null,null,3639782], > > ,[16,4704467,0,1,4,854,null,885,null,null,4431105], > > ,[16,7926627,0,0,5,1528,null,1548,null,null,7781460], > > ,[16,66292957,0,0,5,6422,null,6441,null,null,66107705], > > ,[16,70676534,0,0,5,6815,null,6839,null,null,70500809], > > ,[16,77370138,0,0,5,7593,null,7623,null,null,77302778], > > ,[16,78660658,0,0,5,7835,null,7857,null,null,78509079], > > ,[16,88970818,0,0,5,9977,null,10003,null,null,88872145]]]] > > > > -- > > 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 [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
