Re: [jackson-user] How to read/write encoded characters

2016-11-10 Thread Tatu Saloranta
This is tricky, and in general there isn't way to force "raw" inclusion for pass-through data: content must be first decoded from XML, and re-encoded. It would not be possible via Stax, even with direct access. However, question of escaping '>' (which Woodstox only does if it's part of "]]>", as r

Re: [jackson-user] Re: How to read/write encoded characters

2016-11-11 Thread Tatu Saloranta
Oh. Actually, never mind that one. I should have checked the link first -- this is for JSON output. What Woodstox offers is, as per issue you filed (thanks!) property `P_TEXT_ESCAPER`. Wiring this via `CharacterEscapes` would be the clean way. Until then, this thread: http://forum.spring.io/forum

Re: [jackson-user] Getting lexical information in the tree model?

2016-11-13 Thread Tatu Saloranta
No, for two reasons: 1. JsonNode is singly linked, only parent -> child linkage (not a problem for root node itself, but in general) 2. JsonNode does not have JsonLocation, since this is not needed in general to get location information, you need to use JsonParser directly, or sub-class JsonNode

[jackson-user] Jackson 2.8.5 release in progress: dataformats, JAX-RS, Scala still to be completed

2016-11-15 Thread Tatu Saloranta
As some of you may have noticed, I started pushing Jackson 2.8.5 patch release yesterday. Core components are out, as well as datatypes, base modules, and half of dataformats. I still need to figure out one thing wrt binary dataformats but hope to push them tonight (within 12 hours); after which JA

Re: [jackson-user] JsonIgnore annotation is not documented well

2016-11-22 Thread Tatu Saloranta
Thank you for reporting this: I will update documentation as suggested! -+ Tatu +- On Mon, Nov 7, 2016 at 3:23 AM, Alexander Mironenko wrote: > Hi all, > > Just found the behaviour relate to JsonIgnore annotation. The cause is > described here: http://stackoverflow.com/questions/27571380/ > jac

Re: [jackson-user] Need an XML element with attribute=value pairs from a hashmap

2016-11-28 Thread Tatu Saloranta
Unfortunately there is no mechanism currently to force Map values to be written out as attributes: such facility only exists for POJOs. In theory something could be added to allow marking somehow (perhaps annotation) the intent that Map values should be written out as attributes. Challenge is two

Re: [jackson-user] Mixin factory methods?

2016-11-29 Thread Tatu Saloranta
Yes, target must have something to attach mix-ins to: mix-in classes code is never used for anything, just annotations. But anything target class has (or its super-classes) should be legal target. Do you have an example of target/mix-in class to show what you want to do; looking at code can not gi

Re: [jackson-user] Json data with xml as string for field.

2016-11-29 Thread Tatu Saloranta
No, you'll have to handle it on your own; possibly by using separate `XmlMapper` for values. -+ Tatu +- On Mon, Nov 28, 2016 at 11:28 PM, wrote: > How do I parse a json containing xml as string in one of the field. > > Pojo: >class A { > B b; > int val1; > string s; >} >

Re: [jackson-user] Register custom TypeIdResolver on ObjectMapper without using JsonTypeIdResolver annotation

2016-11-29 Thread Tatu Saloranta
Unfortunately handling of TypeIdResolver is quite strongly coupled with that of `TypeResolverBuilder`, and your best route would probably be via annotation introspector. Although I actually like your approach above: did not know it would actually work (I spent some time back in the day trying to fi

Re: [jackson-user] Mixin factory methods?

2016-11-30 Thread Tatu Saloranta
wrote: > no that's fine, sounds like a clean design - mixins are for annotations, > that's all. i was trying to add a factory method that only existed in the > mixin, i just used a value instantiator instead. > > On Tuesday, 29 November 2016 18:43:30 UTC, Tatu Saloranta

Re: [jackson-user] Changed serialized/deserialized value of enum with mixin

2016-12-05 Thread Tatu Saloranta
On Fri, Dec 2, 2016 at 2:00 PM, Michael Harris wrote: > Hi all > > We have an interesting issue where we are using one model and two json > schemas. We have had good luck using ObjectMapper.addMixin to basically set > up the translation of the model for the relevant schema. Now we have an > issu

[jackson-user] Re: [jackson-dev] Re: Jackson 2.8.5 release in progress: dataformats, JAX-RS, Scala still to be completed

2016-12-08 Thread Tatu Saloranta
Everything else done a long ago. Not sure what Scala status is. -+ Tatu +- On Thu, Dec 8, 2016 at 1:02 PM, Steve A. wrote: > What's the lastest status on 2.8.5 esp. wrt scala? > > On Tuesday, November 15, 2016 at 2:36:10 PM UTC-5, Tatu Saloranta wrote: >> >> As some

Re: [jackson-user] Behaviour change in jackson-databind TypeFactory affecting attempted upgrade in swagger-core

2016-12-12 Thread Tatu Saloranta
For sake of completeness (full desc in issue filed): there is no way to match the behavior with code, because usage can not be fully supported. This was not known at the time API was left open. The underlying issue is that generic `java.lang.reflect.Type` types can only be fully and reliably resol

Re: [jackson-user] Type info is not serialized when a @JsonTypeInfo element is a part of a collection or map

2016-12-13 Thread Tatu Saloranta
Quick answer is that you are probably hitting this: https://github.com/FasterXML/jackson-databind/issues/1410 and the underlying problem here is that you have both "type" metadata property (default for `@JsonTypeInfo`) and data property "type". Either you should not add data property at all (comm

Re: [jackson-user] Type info is not serialized when a @JsonTypeInfo element is a part of a collection or map

2016-12-13 Thread Tatu Saloranta
On Tue, Dec 13, 2016 at 8:41 AM, Lev Kuznetsov wrote: > Instinctively I'd like to avoid having the @JsonGetter method at all as I > feel the @JsonTypeInfo should do everything for me, afterall it does on the > deserialization. I'm fine with including it as As.EXISTING_PROPERTY since it > produces

Re: [jackson-user] List has multiple fields, some are nutll. want to remove them

2016-12-13 Thread Tatu Saloranta
There is nothing automatic, since where `null` removal does not generally change meaning of POJOs (since properties default to `null`), JSON Arrays are index-based on null removal would generally change meaning as it changes position of remaining values. So it is not supported by any settings: you

Re: [jackson-user] Type info is not serialized when a @JsonTypeInfo element is a part of a collection or map

2016-12-14 Thread Tatu Saloranta
The reason for (4) is the good old Java Type Erasure. What you writing out is essentially `Map`, as far as available type information tells -- there is nothing that could tell otherwise. So as general rule: - Do not serialize generic values as root value, if possible. o but if you do, you MUS

Re: [jackson-user] Type info is not serialized when a @JsonTypeInfo element is a part of a collection or map

2016-12-15 Thread Tatu Saloranta
On Thu, Dec 15, 2016 at 8:13 AM, Lev Kuznetsov wrote: > But why would the type erasure on the map be the deciding factor here? The > type of the value is known at runtime, it is Bar, it has a property lol - > that gets serialized no problem, clearly it knows the type and therefore can > see the @J

Re: [jackson-user] examples of Full data binding - converting from Java bean to JSON string

2016-12-15 Thread Tatu Saloranta
On Thu, Dec 15, 2016 at 11:47 AM, Literate Aspects wrote: > How can take my remote data (generated by a Model class bean and a remote > data connect bean displayed in xhtml VIEW [live xhtml VIEW][1]) and convert > -- that POJO into a JSON string -- to use in jquery objects? > > > Seeking an exampl

Re: [jackson-user] Re: serializing POJOs

2016-12-15 Thread Tatu Saloranta
First: how would you know how many have seen your message? Just because there are no answers does not mean much: mailing lists messages are sent as emails and there is no way to track that. It is possible that Web UI has separate counts. Second: what's with the entitlement? Do you really expect ev

Re: [jackson-user] Deserialize/Serialize an Object in two different ways

2016-12-15 Thread Tatu Saloranta
That should work: you do need 2 separate ObjectMappers, and a way to change polymorphic type inclusion. If using default typing it's simple (just setting for mapper), but otherwise need to apply changes to settings. Options I would have suggested include: 1. Use of mix-in annotations (to add or ov

[jackson-user] On vacation until Jan 4, 2017

2016-12-20 Thread Tatu Saloranta
Quick note: I am now on vacation, and while I may be checking (and occasionally responding) my emails, I won't be working on any issues. I will be checking the backlog in january so no reason not to file bugs, add updates, but my follow-up will be slower than usual. Happy holiday season to everyon

[jackson-user] Re: [jackson-dev] On vacation until Jan 4, 2017

2017-01-05 Thread Tatu Saloranta
, Tatu Saloranta wrote: > Quick note: I am now on vacation, and while I may be checking (and > occasionally responding) my emails, I won't be working on any issues. I will > be checking the backlog in january so no reason not to file bugs, add > updates, but my follow-up will be

Re: [jackson-user] jackson 2.8 and KitKat

2017-01-05 Thread Tatu Saloranta
These are dynamically loaded, so they should not prevent use on pre-java-8 platforms. Detection is done dynamically by trying to load the class you reference; if that fails, that part of functionality is disabled. So this should not prevent usage; warning itself should be harmless. If there is a b

Re: [jackson-user] Jackson is serializing Map to Map if value is like 1.0 it would be ser

2017-01-05 Thread Tatu Saloranta
On Tue, Dec 20, 2016 at 9:52 PM, Vikrant Chaudhary wrote: > Jackson is serializing Map to Map if value is > like 1.0 it would be serialized as 1. Please let me know if there is a way > to keep this float value as it is or if I can covert it to a string, so the > output will be like "1.0". I think

Re: [jackson-user] Polymorphic Deserialization via Duck Typing

2017-01-05 Thread Tatu Saloranta
On Wed, Dec 21, 2016 at 8:55 AM, Marvin Addison wrote: > I'm interested in implementing something similar to the following: > > http://stackoverflow.com/questions/16488951/jackson-polymorphic-deserialization-can-you-require-the-existence-of-a-field-i > > Thus the selection of a class for deseriali

Re: [jackson-user] Issue with Jackson polymorphism and a generic list

2017-01-06 Thread Tatu Saloranta
On Wed, Dec 28, 2016 at 1:48 PM, Milan Milanov wrote: > From the couple of threads i read both here and on Github, I'm left with the > impression that Jackson handles correctly the case where a POJO contains a > list of some "polymorphic" type, during serialization. For example, an > instance of a

Re: [jackson-user] How to deserialize a generic class with two parameters?

2017-01-08 Thread Tatu Saloranta
JavaType construction itself looks ok. So that should not be causing the problem. Without seeing more of code it is hard to know what could be causing the issue: so a code snippet that contains call to `readValue()` (or even better unit test) would be needed to resolve the issue. -+ Tatu +- On Tu

Re: [jackson-user] Serialize specific field list only (at runtime)

2017-01-08 Thread Tatu Saloranta
There is no built-in support for specifically filtering out named fields, although doing this using @JsonFilter should be possible. It's briefly explained at: http://www.cowtowncoder.com/blog/archives/2011/02/entry_443.html and in bit more detail at: http://www.cowtowncoder.com/blog/archives/201

Re: [jackson-user] corruption of string values

2017-01-09 Thread Tatu Saloranta
Sounds definitely peculiar... and not something I can immediately tie into specific thing. I don't think any code within `JsonParser` does (or is allowed to) modify contents of input buffer, although obviously pre-/post-increment operator would sound like something that could be relevant here. On

Re: [jackson-user] Deserializing @JsonUnwrapped fields with @JsonCreator annotated constructors

2017-01-11 Thread Tatu Saloranta
On Wed, Jan 11, 2017 at 3:45 AM, wrote: > Hi, > > I am familiar with the issues > https://github.com/FasterXML/jackson-databind/issues/265 (i.e., using > @JsonUnwrapped within a @JsonCreator) and others, but in the end, I couldn't > find the correct way of using @JsonUnwrapped with @JsonCreator (

Re: [jackson-user] corruption of string values

2017-01-11 Thread Tatu Saloranta
additional copy from external buffer to internal one). Doing that could help suggest where the problem occurs. -+ Tatu +- On Mon, Jan 9, 2017 at 2:57 PM, wrote: > I'm not using afterburner. > Input is byte array. > > Brian > > On Monday, January 9, 2017 at 1:25:31 PM UTC

Re: [jackson-user] Deserializing @JsonUnwrapped fields with @JsonCreator annotated constructors

2017-01-12 Thread Tatu Saloranta
o such improvement has been made yet. > > Of course not using @JsonUnwrapped is not an option here :) > > Thanks for your help in any case! Likewise! -+ Tatu +- > > Le mercredi 11 janvier 2017 21:53:14 UTC+1, Tatu Saloranta a écrit : >> >> On Wed, Jan 11, 2017 at 3:45 AM, w

Re: [jackson-user] @JsonInclude is ignored when using BeanSerializerModifier

2017-01-16 Thread Tatu Saloranta
Ignored in what way? What is happening? What does your `JsonViewOverrideSerializer` look like? One common problem is that all delegating serializers MUST implement `ResolvableSerializer` and `ContextualSerializer`, and delegate them to underlying serializer -- otherwise that instance can not be re

Re: [jackson-user] Re: Can Jackson reuse Key-Strings?

2017-01-17 Thread Tatu Saloranta
I am also bit puzzled by the original question, so perhaps it is good to indicate that by default Jackson core (JsonParser) does two things to ALL json property keys: 1. Canonicalizes them so that there is only one instance of each distinct key (like "property"): no new Strings are allocated. This

[jackson-user] Working on improving Jackson Avro module, feedback appreciated

2017-01-20 Thread Tatu Saloranta
Although Jackson has had Avro backend for quite a while -- in fact, it was introduced in 2.1, over 4 years ago -- it hasn't been widely adopted, and feature-wise there has been much development aside from bug fixes (big thank you to all adopters who have reported them!). Lately there have been a f

Re: [jackson-user] Is there an annotation similar to @JsonCreator for setters that accept more than one parameter?

2017-01-20 Thread Tatu Saloranta
No, currently there is no way to have what amounts to multiple-argument setters. From annotation perspective it should be possible to just use `@JsonSetter` for such methods, but internally those are not yet supported. They would be nice to support, but would likely require lots of work due to inte

Re: [jackson-user] Serialize Generic Collection Issues

2017-01-20 Thread Tatu Saloranta
One problem I see is the use of `As.EXTERNAL_PROPERTY`: this is not what you want based on expected json structure. Instead you probably just want to use plain `As.PROPERTY` (unless you want to also map it to a regular, existing property, in which case `As.EXISTING_PROPERTY` may be more appropriate

Re: [jackson-user] Avro: Is is possible to serialize multiple objects to a file?

2017-01-24 Thread Tatu Saloranta
Apologies for a slow response here: yes, once this: https://github.com/FasterXML/jackson-dataformats-binary/issues/35 gets into release (2.7.9 and 2.8.7) this will work using `SequenceWriter`, like so: SequenceWriter w = mapper.writer(schema) .writeValues(file); w.write(item1);

Re: [jackson-user] Serialize Generic Collection Issues

2017-01-25 Thread Tatu Saloranta
stance.class, name = > "unknown")}) > public abstract class ObjectInstance implements Serializable { > private static final long serialVersionUID = -8515880933242237477L; > private List fields; > } > > > Br > > On Friday, January 20, 2017 at 11:57:44 PM U

Re: [jackson-user] ProGuard

2017-01-26 Thread Tatu Saloranta
Since this has been asked a few times (every now and then), it would be great if existing settings could be shared -- I am pretty sure they do exist. This would help developers on Android platform. A section for `jackson-docs` or just README of `jackson` dedicated to things to consider on Android

Re: [jackson-user] ProGuard

2017-01-29 Thread Tatu Saloranta
For what it is worth, I added the contribution Tobias kindle sent under: https://github.com/FasterXML/jackson-docs/wiki/JacksonOnAndroid and if/when others have improvement suggestions or alternatives, please let us know. I think these are exactly kinds of things developers would find valuable to

Re: [jackson-user] How to send a Java object form client (written in Java) to server (written in C) and print values ?

2017-01-29 Thread Tatu Saloranta
Yes, you can serialize a Java object as CBOR using Jackson's `jackson-dataformat-cbor` as extension of `jackson-databind`. As you would know by reading the README at: https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor it's something like: ObjectMapper mapper = new Object

Re: [jackson-user] Inconsistent jackson databinding behavior.[Fasterxml/databinding issue]

2017-01-31 Thread Tatu Saloranta
I can not think of anything specific in this area that would cause such problems. The first thing I would strongly recommend, however, is to upgrade to the latest patch of the minor version you have: there is absolutely no reason to use 2.6.1 over latest one, 2.6.7. If the problem still persists,

Re: [jackson-user] [Question] Has a plan that MapperConfigBase#withView is supported array parameter?

2017-02-02 Thread Tatu Saloranta
I am not aware of any plans to make changes to allow multiple concurrent views at the same time. The intent has been that since View identifiers are classes (which includes interfaces), you can already combine Views to some degree by inheritance (interfaces that extend multiple interfaces, classes

Re: [jackson-user] Construct type for class implementing List bound to specific generic type

2017-02-02 Thread Tatu Saloranta
Ok, code has a few problems. First: method `constructFromCanonical()` really isn't meant to be end-user functionality. Maybe Javadocs should make this clear, but it is not something I was planning to be used by anything but core Jackson functionality. I can sort of see why it might seem useful, bu

Re: [jackson-user] Could not deserialize using @JsonAnySetter annotation on a POJO with Builder

2017-02-03 Thread Tatu Saloranta
Please file an issue against `jackson-databind`. -+ Tatu +- On Mon, Jan 30, 2017 at 10:23 PM, Charan Kumar wrote: > Hi, > I am getting the following error when I try to deserialize an Object with > a Builder and @JsonAnySetter on a field. > > Error: > *com.fasterxml.jackson.databind.JsonMappi

[jackson-user] Jackson 2.7.9 patch release process started

2017-02-04 Thread Tatu Saloranta
So far pushed out core components (annotations, streaming, databind), base modules. Will proceed with dataformats, datatypes and then languages (kotlin, scala). As usual, process may take a while. This is likely to be the last 2.7.x release for a while; it may even be the last patch. But branch is

Re: [jackson-user] Using a converter only on root object/collection

2017-02-07 Thread Tatu Saloranta
There is no functionality to do it the way you suggested (although immutability of classes is not a blocker, you could use mix-in annotations). But wouldn't it be simpler to use a simple wrapper structure to get structure match the output, instead of trying to change the whole serialization logic

Re: [jackson-user] Error deserializing to object

2017-02-09 Thread Tatu Saloranta
That sounds like an odd result. From code it looks like simple valid usage that sound not fail. Are you using a recent Jackson version? (2.7.9 or 2.8.6) -+ Tatu +- On Wed, Feb 8, 2017 at 9:44 PM, Solar Entropy wrote: > Not entirely sure where to ask for help with this, but I'm having an issue >

Re: [jackson-user] How best to migrate old objects

2017-02-09 Thread Tatu Saloranta
I don't know of any specific facility, and since Jackson specifically stays of Transformation use cases (with some minor exceptions for simple unwrapping), it may be out of scope for automated handling. Having said that I would think a common pattern would be to read input as tree (`JsonNode`), ma

Re: [jackson-user] Android - Problem deserialising JSON to object in 'release' builds

2017-02-10 Thread Tatu Saloranta
I have not heard of such problem. But make sure NOT to disable `FAIL_ON_UNKNOWN_PROPERTIES` DeserializationFeature -- (too) many developers automatically disable this feature, and end up hitting all kinds of issues that are not reported. While the feature may make sense to enable in production (an

Re: [jackson-user] Android - Problem deserialising JSON to object in 'release' builds

2017-02-13 Thread Tatu Saloranta
; mode. > > Jonathan > > On Friday, 10 February 2017 19:19:59 UTC, Tatu Saloranta wrote: >> >> I have not heard of such problem. >> >> But make sure NOT to disable `FAIL_ON_UNKNOWN_PROPERTIES` >> DeserializationFeature -- (too) many developers automatic

Re: [jackson-user] Using a converter only on root object/collection

2017-02-13 Thread Tatu Saloranta
difySerializer() called for > Collection? Because `modifyCollectionSerializer()` is called for it; they are type-specific. -+ Tatu +- > > Thanks, > > On Tuesday, February 7, 2017 at 8:28:56 PM UTC+1, Tatu Saloranta wrote: >> >> There is no functionality to do it the way you s

Re: [jackson-user] ObjectMapper configuration: multiple POJO's using a custom Shape

2017-02-15 Thread Tatu Saloranta
On Wed, Feb 15, 2017 at 11:38 AM, Mike Price wrote: > I am currently attempting to implement some of the tricks described in this > presentation to increase performance. I would like to be able to change a > particular ObjectMapper instance to serialize all POJO's using a particular > JsonFormat.S

Re: [jackson-user] Serialization of any object with parent-child relationships without outputing the ID value

2017-02-16 Thread Tatu Saloranta
On Thu, Feb 16, 2017 at 1:43 PM, David Hayek wrote: > If I have to serialize an object that I can not annotate and that contains > parent-child relationship, such as a DefaultMutableTreeNode, I can avoid the > infinite recursion/stack overflow problem by supplying an ObjectIdGenerator > from the f

Re: [jackson-user] jackson jax-rs providers and custom serializer and deserializer

2017-02-17 Thread Tatu Saloranta
Usually my first guess is that configured `ObjectMapper` is not being used at all. So if you can re-configure mapper in some other way (like default to indenting or something) maybe you can eliminated the possibility that this mapper is not being used? Another small thing is that `findAndRegisterM

Re: [jackson-user] Serialization of any object with parent-child relationships without outputing the ID value

2017-02-17 Thread Tatu Saloranta
probably work better, if I understand use case. -+ Tatu +- > > Thanks > > David > > > > > > On Thursday, February 16, 2017 at 4:40:19 PM UTC-6, Tatu Saloranta wrote: >> >> On Thu, Feb 16, 2017 at 1:43 PM, David Hayek wrote: >> > If I have t

Re: [jackson-user] Serialization of any object with parent-child relationships without outputing the ID value

2017-02-17 Thread Tatu Saloranta
to just omit value (f.ex. in case property is to be serialized, name is already written); except if property itself is to be excluded (using `@JsonInclude` mechanism for example). -+ Tatu +- > > Thanks > > David > > > On Friday, February 17, 2017 at 1:49:47 PM UTC-6, Tatu Salora

Re: [jackson-user] jackson jax-rs providers and custom serializer and deserializer

2017-02-18 Thread Tatu Saloranta
>> What do you meant by "re-configure mapper in some other way". Could you >> please provide some more details? >> My guess is that JacksonJsonProvider is not getting used at all. How do >> you I know that? >> >> -Nikhil >> >> On Saturday, Fe

Re: [jackson-user] com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input within/between Array entries

2017-02-18 Thread Tatu Saloranta
Um, how are we supposed to help if you don't provide either: 1. Classes you use for reading/writing 2. JSON being read (or expected to be written) ? Including list of symptoms may help but these two things are the most important. -+ Tatu +- On Fri, Feb 17, 2017 at 1:54 PM, vivek sharma wrote

[jackson-user] Jackson 2.8.7 patch release in progress

2017-02-20 Thread Tatu Saloranta
As per title, 2.8.7 is being released. Change list at: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8.7 and upgrade is, as usual, recommended; although nothing considered generally critical fix was included this time (YMMV of course). We are also getting very close to 2.9.0.pr1; h

Re: [jackson-user] Custom deserializing Map where Foo is polymorphic

2017-02-20 Thread Tatu Saloranta
Almost but not quite. Use of `@JsonTypeInfo(include=As.WRAPPER_OBJECT)` would indeed allow use of JSON property name as type identitifier. This would work for property values, and Lists/Arrays, but not quite the way you'd want for Maps. So if I understand use case correctly, there is nothing out o

[jackson-user] Scala module patches 2.7.9, 2.8.7 now out as well

2017-02-21 Thread Tatu Saloranta
As per: https://github.com/FasterXML/jackson-module-scala/issues/295 and thanks to Morten's work, Scala module once again at parity with other modules. Including support for Scala 2.12. This, along with use of `jackson-bom` versions 2.7.9 and 2.8.7 should allow much smoother upgrades and version

[jackson-user] Creating "safe" or "unchecked" ObjectReader, ObjectWriter (for Java 8 streams)

2017-02-21 Thread Tatu Saloranta
One of remaining "big ticket items" I still hope to implement for Jackson 2.9 is so-called "safe" ObjectReader and ObjectWriter. This means reader/writer that only exposes unchecked exceptions; by necessity wrapping (or perhaps converting) regular `IOException`s and `JsonProcessingException`, `Json

Re: [jackson-user] Custom deserializing Map where Foo is polymorphic

2017-02-22 Thread Tatu Saloranta
as further context. -+ Tatu +- > > On Tuesday, February 21, 2017 at 12:00:58 AM UTC-5, Tatu Saloranta wrote: >> >> Almost but not quite. Use of >> `@JsonTypeInfo(include=As.WRAPPER_OBJECT)` would indeed allow use of >> JSON property name as type identitifier. This wou

Re: [jackson-user] Type information missing due to cached serializer

2017-02-23 Thread Tatu Saloranta
On Thu, Feb 23, 2017 at 5:33 AM, wrote: > Hello, > > I have the following scenario: > > * Map > > * CustomClass contains a field Map, and has a > CustomClassSerializer registered in module added to the ObjectMapper > > * the CustomClassSerializer calls enableDefaultTyping() on the ObjectMapper

Re: [jackson-user] jackson-databind uses compact2 profile

2017-02-28 Thread Tatu Saloranta
What is compact1 profile? -+ Tatu +- On Mon, Feb 27, 2017 at 3:13 AM, Ferry Huberts wrote: > I would really like to run the jackson bundles under compact1 profile for my > JSON serialisation. > > Is it possible to adjust the databind bundle so that it only uses the > compact1 profile? > > Thanks

Re: [jackson-user] Re: Receiving JSON data from POST

2017-02-28 Thread Tatu Saloranta
Looking at the exception output, interesting part is this: at [Source: start_date=28%2F02%2F2017+14%3A01&end_date=01%2F03%2F2017+14%3A03&report_date=01%2F03% which gets printed because input comes as a String (otherwise wouldn't print, although Jackson 2.9 does improve on this a bit). So inpu

Re: [jackson-user] deserialization context and path parameters in an http context

2017-03-01 Thread Tatu Saloranta
Jackson databind has no idea where calls comes from, so by default no. JAX-RS provider could theoretically pass this information, but this has not been wired. I think you could build something using `ObjectReaderModifier` and `ObjectReaderInjector` to pass information from endpoint, using context

Re: [jackson-user] Polymorphic deserialization - @JsonTypeInfo “defaultImpl” for collections

2017-03-06 Thread Tatu Saloranta
On Fri, Mar 3, 2017 at 3:16 AM, Jothisubaramaniam P wrote: > There is one set of definition as follows: > > @JsonTypeInfo( > use = JsonTypeInfo.Id.NAME, > include = JsonTypeInfo.As.EXISTING_PROPERTY, > property = "type", > visible = true) > @JsonSubTypes({ >

Re: [jackson-user] Jackson XML :: Serialized differs from the original

2017-03-06 Thread Tatu Saloranta
The problem with your code is that you are for some reason assuming that `user` would be dropped for some reason: it is not. JSON structure that would be equivalent is rather: { "user" : { "name" : "Joe", "age" : 28 } } So basically there is no 'age' property in main level object: the

Re: [jackson-user] jackson-databind uses compact2 profile

2017-03-06 Thread Tatu Saloranta
be possible to use Jackson without access to these classes, but not build. It should be possible to test this out if anyone has such environment to try. -+ Tatu +- On Wed, Mar 1, 2017 at 3:06 AM, Ferry Huberts wrote: > > > On Wednesday, March 1, 2017 at 2:14:27 AM UTC+1, Tatu Salora

Re: [jackson-user] Jackson and XHTML

2017-03-13 Thread Tatu Saloranta
Jackson XML backend does not really support mixed content -- content model that has both non-whitespace text AND elements. This is difficult to represent with databinding, and is mostly operated with XML-centric models like DOM. There has been some talk about exposing this in some form or fashion,

Re: [jackson-user] Jackson and XHTML

2017-03-13 Thread Tatu Saloranta
in Jackson? For example, if I wanted to try to have Jackson skip > over/ignore certain tags like , , and , where should I look? > > On Monday, March 13, 2017 at 1:33:20 PM UTC-4, Tatu Saloranta wrote: >> >> Jackson XML backend does not really support mixed content -- co

Re: [jackson-user] Jackson XML :: Serialized differs from the original

2017-03-14 Thread Tatu Saloranta
ported use case. -+ Tatu +- > > -- > D. > > Em segunda-feira, 6 de março de 2017 21:52:36 UTC-3, Tatu Saloranta > escreveu: >> >> The problem with your code is that you are for some reason assuming >> that `user` would be dropped for some reason: it

Re: [jackson-user] Limiting object depth and collection length during serialization for 3rd party classes

2017-03-15 Thread Tatu Saloranta
There is no such functionality available for either aspects. First one is unlikely to be supported at all as the delegation means that none of serializers is concerned with more than one level (or, possibly another small fixed number considering wrapping for type id handling, or "unwrapped" proper

Re: [jackson-user] Jackson and XHTML

2017-03-15 Thread Tatu Saloranta
how > that goes. I really just want the contents of that as a String in my > POJO anyway, so I might be able to decorate the formatting tags away before > parsing, then re-insert them later. I'll let you know how it works out. > > On Monday, March 13, 2017 at 4:27:47 PM UTC-4, Ta

Re: [jackson-user] Jackson and XHTML

2017-03-15 Thread Tatu Saloranta
ed, Mar 15, 2017 at 4:36 PM, Steve Munini wrote: > Hi Tatu, > > Thank you so much for your help. It worked! I implemented a InputDecorator > which appears to be working now. Thank you! > > Steve Munini > CEO & CTO > 978-590-4493 > heliossoftware.com > > >

[jackson-user] Combining CSV, Properties and CSV format git repos -> jackson-dataformats-text

2017-03-19 Thread Tatu Saloranta
Quick administrative announcement: I am moving ahead with some centralization to make releases simpler to make. Similar to creation of `jackson-dataformats-binary` repo (which builds backends for CBOR, Smile, Avro and Protobuf), I created `jackson-dataformats-text`. This repo contains CSV, Java Pro

Re: [jackson-user] Limiting object depth and collection length during serialization for 3rd party classes

2017-03-20 Thread Tatu Saloranta
I hope someone who has had similar issue can share how they implemented limitations. -+ Tatu +- On Wed, Mar 15, 2017 at 9:40 PM, wrote: > Thanks for the quick reply. Are there workarounds to implement these? > > On Thursday, March 16, 2017 at 1:45:06 AM UTC+5:30, Tatu Salora

Re: [jackson-user] Re: How to access default serializer when writing custom serialiser

2017-03-20 Thread Tatu Saloranta
Not 100% sure I understand the question, but if you want to access information about annotations on property, from your custom serializer, you need to implement `ContextualSerializer`, and then its `createContextual()` gets called with `BeanProperty`. `BeanProperty` has accessors for annotation dir

Re: [jackson-user] How to use type name as element name

2017-03-20 Thread Tatu Saloranta
What is the POJO you are serializing? -+ Tatu +- On Mon, Mar 20, 2017 at 5:11 AM, Zsolt Balanyi wrote: > Hi! > > I have a structure that outputs this: > > > > > > > > > I use @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=As.PROPERTY, > property="type") on the common base cla

Re: [jackson-user] Jackson CSV: Edit header at first row of csv

2017-03-20 Thread Tatu Saloranta
Ok so what do you mean by "edit"? Change the effect taken, or to modify file from which data comes? Or something else? -+ Tatu +- On Fri, Mar 17, 2017 at 9:50 PM, Public Share wrote: > Hi, > > > I'm using jackson csv to write csv file. > But the header is mapping with properties of object. > Ha

Re: [jackson-user] Re: How to access default serializer when writing custom serialiser

2017-03-20 Thread Tatu Saloranta
ialize(using = UIElementSerializer.class) > > BR, Zsolt > > 2017. március 20., hétfő 19:21:29 UTC+1 időpontban Tatu Saloranta a > következőt írta: >> >> Not 100% sure I understand the question, but if you want to access >> information about annotations on property, from

Re: [jackson-user] How to use type name as element name

2017-03-20 Thread Tatu Saloranta
a StackLayout that contains a > Label and an Image. > It would solve the problem, if the JsonTypeInfo could put the type name to > the element name... > > BR, Zsolt > > 2017. március 20., hétfő 19:22:10 UTC+1 időpontban Tatu Saloranta a > következőt írta: >> >

Re: [jackson-user] Re: How to access default serializer when writing custom serialiser

2017-03-20 Thread Tatu Saloranta
PM, Zsolt Balanyi wrote: > Hi! > > OK, thanks, then I'll go that way! > > BR, Zsolt > > 2017. március 20., hétfő 20:13:25 UTC+1 időpontban Tatu Saloranta a > következőt írta: >> >> This can not be done from annotation-based serializer: it will >> ove

Re: [jackson-user] How to use type name as element name

2017-03-21 Thread Tatu Saloranta
supported dataformat. XML is bit of an outlier as its structural model is the most difficult one to support, of formats supported. -+ Tatu +- > > BR, Zsolt > > 2017. március 20., hétfő 20:16:38 UTC+1 időpontban Tatu Saloranta a > következőt írta: >> >> Have you tried choi

Re: [jackson-user] How to use type name as element name

2017-03-22 Thread Tatu Saloranta
he fact that I register it for an abstract > class, and the concrete implementors still use their defaults? BeanSerializerModifier is a callback, but yes, result would be bound for whatever type it was called for. -+ Tatu +- > > BR Zsolt > > > > 2017. március 22., szerda 5:38:56

Re: [jackson-user] Does it make sense to extend the scope of @JsonIgnoreType?

2017-03-22 Thread Tatu Saloranta
Apologies for slow follow-up. I think that usage as List/array element is difficult to implement, and generally I don't think it's something that commonly causes problems. Handling of property values and array elements is quite distinct with current processing so I don't think I'd want to do this.

Re: [jackson-user] How to use type name as element name

2017-03-22 Thread Tatu Saloranta
aformat-xml, or I'm doing wrong something? One possibility is that if the type uses polymorphic handling, method called is actually public void serializeWithType(T value, JsonGenerator g, SerializerProvider p, TypeSerializer ts); and you may need to override that as well. -+ Tatu +- >

Re: [jackson-user] WRAP_ROOT_VALUE when serializing

2017-03-23 Thread Tatu Saloranta
You can enable/disable `SerializationFeature`s using `ObjectWriter` instead of `ObjectMapper`, like so: byte[] bytes = mapper.writer().with(SerializationFeature.WRAP_ROOT_VALUE) .writeValueAsBytes(pojo); I don't know what support Spring Boot offers for doing this. -+ Tatu +- On Mon, Mar 2

Re: [jackson-user] Ignore property of object in list property of a class

2017-03-23 Thread Tatu Saloranta
Actually it should already be possible to use `@JsonIgnoreProperties` for properties as is, but I think it only affects property value itself, and not contents of containers. But it seems reasonable to assume that since Lists/arrays/Maps do not have properties of their own (except in non-standard c

Re: [jackson-user] How to use type name as element name

2017-03-23 Thread Tatu Saloranta
but most documentation refers to public API developers are most likely to use. -+ Tatu +- > > BR, Zsolt > > 2017. március 23., csütörtök 6:45:18 UTC+1 időpontban Tatu Saloranta a > következőt írta: >> >> On Wed, Mar 22, 2017 at 10:24 PM, Zsolt Balanyi >> wrote: >

Re: [jackson-user] JsonMappingException with jackson-databind version 2.8.0 and higher

2017-03-23 Thread Tatu Saloranta
Could you please file an issue for `jackson-databind`. Looks like a bug. -+ Tatu +- On Thu, Mar 23, 2017 at 5:11 PM, Anuj Kumar wrote: > > I am getting an exception with jackson databind version 2.8.0 and later, > everything works fine with any version below 2.8.0. > > Issue is, if I have a prop

Re: [jackson-user] How to use type name as element name

2017-03-27 Thread Tatu Saloranta
more robust. > > > > > > > > > Thanks for your help and hints! Hope I helped someone... Thank you for sharing this! -+ Tatu +- > > BR, Zsolt > > 2017. március 24., péntek 1:06:37 UTC+1 időpontban Tatu Saloranta a > következőt írta

Re: [jackson-user] Changing object type in JSON Schema

2017-03-28 Thread Tatu Saloranta
JSON Schema reflects the fact that Jackson serializes URLs as JSON Strings -- it wouldn't make much sense to report it as Object since that is not its serialization. So this part works the way I would expect it to be: JSON Schema defines the way JSON structures work, not what is semantic view of yo

Re: [jackson-user] Using json annotations with jackson and jax-rs on weblogic 12.2

2017-04-03 Thread Tatu Saloranta
I am not an expert with Weblogic, but I suspect there may be some dependency that includes component that prevents use of Jackson. So... On Tue, Mar 28, 2017 at 2:32 AM, Claude Libois wrote: > Hello, > I have been fighting since yesterday to enforce the simple pojo to me > marshalled as {rules: [

Re: [jackson-user] @JsonAppend, mix-in and interface

2017-04-05 Thread Tatu Saloranta
Yes, it should be possible to add `@JsonAppend` to an interface, without mix-in. So I think filing an issue with simple reproduction (there are already declarations but also call to make sure nothing relevant is omitted) would make sense. -+ Tatu +- On Wed, Apr 5, 2017 at 6:28 AM, Clément Poulain

Re: [jackson-user] ignore namespace during json to java conversion

2017-04-11 Thread Tatu Saloranta
On Tue, Apr 11, 2017 at 12:25 AM, Adarsh Jalaja wrote: > I am trying to send json to convert to java via rest using apache CXF > (3.0.11) > > jackson being used is 2.8.6. > > when I send the plain JSON (without namespace) its giving namespace related > error. This used to work with (1.9 jackson an

<    1   2   3   4   5   6   7   8   9   10   >