Re: [jackson-user] setCurrentValue/getCurrentValue() in XmlReadContext class not implemented

2017-04-12 Thread Tatu Saloranta
Already done: https://github.com/FasterXML/jackson-dataformat-xml/issues/228 but will be part of 2.9.0(.pr3) If anyone observes similarly missing functionality for other context please file issues: unfortunately this change needs to be rolled out incrementally. -+ Tatu +- On Wed, Apr 12, 2017

Re: [jackson-user] How do I deserialize this XML array?

2017-04-13 Thread Tatu Saloranta
Please note that Jackson does not guarantee that it can support all kinds of XML. It does aim to be able to deserialize content it serializes: so if you can find a way to serialize content in certain XML structure, it should be readable. But there are other structures that are not. In this case we

Re: [jackson-user] How do I deserialize this XML array?

2017-04-14 Thread Tatu Saloranta
Tatu, >> >> Thanks for responding. I think I have a similar setup here: >> https://groups.google.com/forum/#!topic/jackson-user/QN3bVAgFluU. But you'll >> notice that the object gets wrapped twice in serialization and expects the >> same for deserialization. Instead of

Re: [jackson-user] Is Jackson TypeReference thread safe?

2017-04-16 Thread Tatu Saloranta
Yes, they are immutable and thread-safe. -+ Tatu +- On Sat, Apr 15, 2017 at 7:45 AM, Anurag Laddha wrote: > Can i use the same com.fasterxml.jackson.core.type.TypeReference instance > across multiple threads? > > Thanks! > > -- > You received this message because you are subscribed to the Google

Re: [jackson-user] [Question] Handle custom date time format while deserializing a JSON into generic collection type

2017-04-17 Thread Tatu Saloranta
There is no way to do that without additional type information: if nominal type is `Object`, JSON String will become Java String and so forth. -+ Tatu +- On Wed, Apr 5, 2017 at 11:31 PM, GIN wrote: > Dear experts, > > I've searched around for a while, but not find an answer. So I decide to > po

Re: [jackson-user] It crashes my app when trying to deserialize with this error: com.fasterxml.jackson.databind.JsonMap

2017-04-18 Thread Tatu Saloranta
Please explan your problem here -- if I wanted to read SO, I'd go to SO read it. This is not a feeder line for StackOverflow. -+ Tatu +- On Tue, Apr 18, 2017 at 4:50 AM, Alin Rosu wrote: > I made a StackOverflow issue about this: > http://stackoverflow.com/questions/43468081/android- > jackson-

Re: [jackson-user] Polymorphic deserialization not working for this case

2017-04-19 Thread Tatu Saloranta
What you try to do does not make sense to me because you try to do both: 1. Specify that `Document` should use polymorphic handling (via `@JsonTypeInfo`) 2. Define exact serializer/deserializer to use Either you should do (1), and let actual (de)serializers be created for or defined by subtypes,

Re: [jackson-user] Polymorphic deserialization not working for this case

2017-04-20 Thread Tatu Saloranta
should go back and try to understand where does custom serializer and deserializer come in: how is serialization different from what standard Bean (De)Serializer would do? -+ Tatu +- > > Thanks again for your help, > - Dmitry > > > On Wednesday, April 19, 2017 at 8:26:1

Re: [jackson-user] Graceful Error Handling/Collection on Databind (2.9.0.pr2)

2017-04-20 Thread Tatu Saloranta
On Thu, Apr 20, 2017 at 1:28 PM, Andrew Joseph wrote: > > I'm looking to simply return null and add errors to a > Map from all JsonDeserializer instances when a > JsonMappingException is encountered (since the JSON parser can continue). In > each of my beans, I plan to use @JacksonInject to inject

Re: [jackson-user] Jackson custom List instance type

2017-04-21 Thread Tatu Saloranta
If javaslang List implementation is a mutable `List`, you can simply register abstract type mapping: SimpleModule m = new SimpleModule(...); m.addAbstractTypeMapping(List.class, SlangList.class); mapper.registerModule(m); -+ Tatu +- On Thu, Apr 20, 2017 at 5:21 PM, Santhosh Kumar wrote

Re: [jackson-user] Graceful Error Handling/Collection on Databind (2.9.0.pr2)

2017-04-21 Thread Tatu Saloranta
(s) and are responsible for trying to keep token stream in compatible state: this is why `skipChildren()` is called for some of the cases. Throwing exceptions generally cuts through call hierarchy and tends to make nested deserializers get off expected state. So choices tend to be to make handler sw

Re: [jackson-user] CVE-2016-7051 status

2017-04-25 Thread Tatu Saloranta
I assume this would be fixed by #211 of `jackson-dataformat-xml`: https://github.com/FasterXML/jackson-dataformat-xml/issues/211 from reading CVE. Note that it is downright wrong to claim that any of `jackson-annotations`, `jackson-core` or `jackson-datatype-joda` would suffer from it -- none of

Re: [jackson-user] Polymorphic deserialization without annotations

2017-04-26 Thread Tatu Saloranta
On Wed, Apr 26, 2017 at 2:24 AM, Johan L wrote: > We're having problems figuring out how to configure jackson to match how > we'd like to have things. We have a bunch of legacy java classes (that we > cannot annotate) that we'd like de-serialize from json. We have something This is the main case

Re: [jackson-user] Re: Polymorphic deserialization not working for this case

2017-04-27 Thread Tatu Saloranta
On Sun, Apr 23, 2017 at 9:12 AM, wrote: > Tatu, > > I got this working as per your comment (to remove any @JsonType and > hand-craft the serialization/deserialization of the type information). I've > got that going in the 2nd version of the code as checked in here: > https://github.com/hexastax/m

Re: [jackson-user] Polymorphic deserialization without annotations

2017-04-28 Thread Tatu Saloranta
d anyway so callers usually pass full generic type. It's only for serialization where convenience of passing instance lures callers into false sense of safety :) -+ Tatu +- > > On Wednesday, April 26, 2017 at 8:03:50 PM UTC+2, Tatu Saloranta wrote: >> >> On Wed, Apr 26, 2

[jackson-user] Some testing for cross-minor-compatibility, Jackson 2.9.0.pr3

2017-05-02 Thread Tatu Saloranta
One idea I have had for a while has been to investigte what level of actual compatibility there is between "close enough" minor versions of Jackson components. Result is this repo: https://github.com/cowtowncoder/jackson-compat-minor As per repo README, while Jackson has the usual semantic versi

Re: [jackson-user] 2.9.0.pr3 readerForUpdating how to replace list instead merge

2017-05-11 Thread Tatu Saloranta
On Thu, May 11, 2017 at 10:20 PM, wrote: > Dears, > > I just upgrade to 2.9.0.pr3 for our project because we need the feature of > merge a json string to update an existing object or hashmap. > > I tested readerForUpdating works now by default deep merge the data in > json string to an existing n

Re: [jackson-user] Re: @JsonTypeInfo doesn't serialize property value in a List

2017-05-12 Thread Tatu Saloranta
I am not sure I understand the question wrt requiring no-arguments constructor: yes, any object that Jackson is to create must be constructed somehow: and choice is usually either via zero-arguments constructor, or a constructor with `@JsonCreator` annotation. What exactly is the exception you get

Re: [jackson-user] Re: Jackson polymorphic deserializer set property = parent object if present

2017-05-13 Thread Tatu Saloranta
Right, the only out-of-the-box facility would be managed/back reference (@JsonManagedReference / @JsonBackReference), and would allow filling in values but does require direct dependency and property on both sides. -+ Tatu +- On Fri, May 12, 2017 at 10:51 AM, Rj Ewing wrote: > > > On Friday, M

Re: [jackson-user] @JsonProperty enum desirialization.

2017-05-15 Thread Tatu Saloranta
On Mon, May 15, 2017 at 3:04 AM, yurivan wrote: > Jackson version 2.8.7 > > I have enum like this > > public enum ShippingMethods { > @JsonProperty("0") > SHIPPING_METHODS_UNSPECIFIED(0), > > @JsonProperty("10") > SHIPPING_METHODS_FED_EX_PRIORITY_OVERNIGHT(10), > > @JsonPropert

Re: [jackson-user] @JsonProperty enum desirialization.

2017-05-16 Thread Tatu Saloranta
Ok. I think I have an idea of the problem (a minimal unit test would have been even simpler way but this works too). Could you file an issue for `jackson-databind` please? I suspect this is related to auto-detection of JSON Strings that look like numbers, accidentally using ordinal() like you sugge

Re: [jackson-user] @JsonProperty enum desirialization.

2017-05-16 Thread Tatu Saloranta
s simple value it is not clear what the difference would be (handling of Enum as Map key, or element of EnumSet is different, however). -+ Tatu +- On Tue, May 16, 2017 at 8:40 AM, Tatu Saloranta wrote: > Ok. I think I have an idea of the problem (a minimal unit test would > have been

Re: [jackson-user] [De]Serialization of types that have no class modification access (JavaFX Properties)

2017-05-17 Thread Tatu Saloranta
On Wed, May 17, 2017 at 10:28 AM, Kevin Brightwell wrote: > Hello, > > I'm trying to implement some serializers/deserializers for JavaFX properties > and have run into several issues: > > Jackson's annotations are not usable as the classes in JavaFX are all part > of the JDK not my own code-base

Re: [jackson-user] [De]Serialization of types that have no class modification access (JavaFX Properties)

2017-05-17 Thread Tatu Saloranta
nships, but only if forward (managed) reference is a Collection or Map or array, but not for multiple properties. For more complex use cases full object identity (@JsonIdentityReference) is needed; it works bit different (first time instance reached it is fully serialized, including Object Id; furt

Re: [jackson-user] Specify resuts fields inside REST request

2017-05-18 Thread Tatu Saloranta
On Thu, May 18, 2017 at 4:05 AM, 'Patrick Kranz' via jackson-user wrote: > Hello all, > > I am spinning my head for two days now in the code of the Jackson Json > Serializer and I guess it is now time to ask somebody. > > I am building REST-APIs with Spring boot and as they are supposed to be > ac

Re: [jackson-user] Re: @JsonTypeInfo doesn't serialize property value in a List

2017-05-22 Thread Tatu Saloranta
ould show what is needed beyond constructor. I don't think that is the only problem here... Actually, also, would need to see result type (`SGSPayload`), possibly in simplified form. -+ Tatu +- > > On Friday, May 12, 2017 at 5:57:12 PM UTC-6, Tatu Saloranta wrote: >> >>

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

2017-05-23 Thread Tatu Saloranta
; but it actually might become handy for > Collection > and > Object[] > > Do you have any ideas for the exclusion described in 1060? I'd gladly create > a PR as currently I have to filter the objects by "not calling the method" > :) > > > W dniu środa, 22 marc

[jackson-user] Jackson 2.8.9 patch version released

2017-06-12 Thread Tatu Saloranta
Jackson 2.8.9: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8.9 is now out, with 16 fixes (or 19, if ignore 2.8.8.1), most in `jackson-databind` as usual. Upgrade from earlier 2.8.x patch versions is this time strongly recommended since there is one security fix (databind #1599),

Re: [jackson-user] How to create deserializer for Map -> List

2017-06-13 Thread Tatu Saloranta
You can register all deserializers via modules. You can not use `SimpleModule`, since you may need bit more information (generic type parameters), so you need to implement `Deserializers` callback that will provide your custom deserializer. But if you also want to use regular deserializer in some

[jackson-user] Jackson 2.9.0.pr4 -- the last pre-release version of 2.9.0 -- now out

2017-06-19 Thread Tatu Saloranta
Ok: so, the process towards 2.9.0 has been slow, but it's coming to an end. pr4 is out; and we would really appreciate anyone who could kick the tires and report last minute regressions compared 2.8. Release notes are at: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9 hopefully cov

Re: [jackson-user] What are the tradeoffs with using afterburner? ( https://github.com/FasterXML/jackson-module-after )

2017-06-20 Thread Tatu Saloranta
On Thu, Jun 15, 2017 at 9:11 PM, Bwmat wrote: > Just wondering why it's an optional module, and hasn't just been integrated > into the core? From the page it seems like a 'free' speedup. > Cheers, > Bwmat Original reasoning was due to nature of the extension -- using bytecode generation, on-the-f

Re: [jackson-user] How to serialize a property of POJO as oneOf?

2017-06-20 Thread Tatu Saloranta
At this point we must, I think, consider `jackson-module-jsonSchema` to be unsupported, and probably dropped from Jackson 3.x as core component. You may want to look for other JSON Schema generators. -+ Tatu +- On Thu, May 25, 2017 at 11:26 PM, Vibhor Mahajan wrote: > I have a requirement wher

Re: [jackson-user] Is fuzzy mapping a possibility?

2017-06-20 Thread Tatu Saloranta
I don't think this is something I want to do at databinding level: names should match. Trying to make sense of "almost there" cases tends to lead problems like HTML, where complexity has grown exponentially, in order to accommodate for what often is case of "lazy developer". Having said that, ther

Re: [jackson-user] 2.9.0.pr3 readerForUpdating how to replace list instead merge

2017-06-20 Thread Tatu Saloranta
is technically unfeasible at this point. -+ Tatu +- On Sun, May 14, 2017 at 9:33 PM, wrote: > I tried with mapper.configOverride(List.class).setMergeable(Boolean.FALSE); > > It seems not working. > > On Friday, May 12, 2017 at 4:01:14 PM UTC+9:30, Tatu Saloranta wrote: >&g

Re: [jackson-user] Re: What are the tradeoffs with using afterburner? ( https://github.com/FasterXML/jackson-module-after )

2017-06-20 Thread Tatu Saloranta
Good. And thank you for asking this -- it is indeed a good question. -+ Tatu +- On Tue, Jun 20, 2017 at 2:15 PM, Bwmat wrote: > Thanks for the reply, that makes sense. I'll try afterburner out when we get > to the point of performance testing. > > > On Thursday, June 15, 2017 at 9:40:48 PM UTC-

Re: [jackson-user] Re: Bug with combining @jsoncreator w/ @jsonproperty(index = XXX)?

2017-06-20 Thread Tatu Saloranta
On Tue, Jun 20, 2017 at 2:14 PM, Bwmat wrote: > Tried with 2.8.9, same problem, but, I had an idea... > > replacing the line >>public pojo(@JsonProperty(index = 0) int x, @JsonProperty(index = 1) int y) > > with the line > >>public pojo(@JsonProperty(index = 0, value = "d") int x, >> @JsonProperty

Re: [jackson-user] JacksonXmlRootElement does not enforce the local name

2017-06-21 Thread Tatu Saloranta
This seems unfortunate, and I think is just a kink of the way structural impedance between XML and JSON is resolved (JSON does not have names for Object, only for properties; XML elements/attributes always have names). Could you file in issue against `jackson-dataformat-xml` for this please? (unle

Re: [jackson-user] How to serialize a property of POJO as oneOf?

2017-06-21 Thread Tatu Saloranta
generation better. -+ Tatu +- On Wed, Jun 21, 2017 at 12:14 AM, Morten Kjetland wrote: > Hi, > > You might want to give this project a try: > > https://github.com/mbknor/mbknor-jackson-jsonSchema > > -Morten > > On Tue, Jun 20, 2017 at 8:28 PM Tatu Saloranta wrote:

Re: [jackson-user] JsonInclude(Include.NON_DEFAULT) on a property Date

2017-06-23 Thread Tatu Saloranta
That sounds like a bug, make sure to file, along with version it's reproduced with. I recall there being some practical challenges in making defaulting work in pluggable manner (the only other types for which this differs from 'empty' are primitives and wrappers for them), but as per javadocs these

Re: [jackson-user] @JsonValue and type resolver info on serialization

2017-06-26 Thread Tatu Saloranta
I haven't quite read the whole thing, but first things first: I think that you should not try to combine `@JsonValue` with polymorphic type handling. This is problematic because of ambiguity (during processing) between type of Java Object being returned by method, and logical type it represents (th

Re: [jackson-user] @JsonValue and type resolver info on serialization

2017-06-26 Thread Tatu Saloranta
jackson-dataformats-binary` please? Ion backend just moved there. (or PR for extra points -- a test case would definitely make sense). -+ Tatu +- > > Michael > > > On Monday, June 26, 2017 at 6:39:34 PM UTC+1, Tatu Saloranta wrote: >> >> I haven't quite read the whol

[jackson-user] Opinions on `jackson-databind` PR #1681 ("can not" -> "cannot" in exception messages)

2017-06-27 Thread Tatu Saloranta
Quick question: I would appreciate quite sanity check on this PR https://github.com/FasterXML/jackson-databind/pull/1681 which proposes to change wording of comments and exception messages so that "cannot" would be used in place of "can not" in most (or all?) instances. I do not feel qualified to

Re: [jackson-user] @JsonValue and type resolver info on serialization

2017-06-27 Thread Tatu Saloranta
see if I can start working on a PR. > > On Tuesday, June 27, 2017 at 12:53:18 AM UTC+1, Tatu Saloranta wrote: >> >> On Mon, Jun 26, 2017 at 1:08 PM, Michael Liedtke >> wrote: >> > Hi Tatu, >> > The example was using the ClassNameIdResolver as the default res

Re: [jackson-user] deserializing combination of Default and explicitly typed elements

2017-06-28 Thread Tatu Saloranta
The general rule is this: Jackson will deserialize polymorphic type inclusion that uses same structure as it writes. This means that inclusion of type id (or not) must match on serialization and deserialization. Further, it is not possible to either add type id where one is not expected, or drop it

Re: [jackson-user] Updating (existing) Collection-Entries in a @JsonMerge annotated Collection from own JsonDeserialize

2017-06-30 Thread Tatu Saloranta
Intent, simply, is not to try anything other than call `add()` on `Collection`s (or for arrays, add at the end). No support is planned by databind itself for any other operations. For `Set`s this would allow replacement. -+ Tatu +- On Thu, Jun 29, 2017 at 5:54 AM, Christian wrote: > Hi, > > I'm

Re: [jackson-user] Updating (existing) Collection-Entries in a @JsonMerge annotated Collection from own JsonDeserialize

2017-06-30 Thread Tatu Saloranta
On Fri, Jun 30, 2017 at 5:27 PM, Tatu Saloranta wrote: > Intent, simply, is not to try anything other than call `add()` on > `Collection`s (or for arrays, add at the end). > No support is planned by databind itself for any other operations. > For `Set`s this would allow replacement.

[jackson-user] Re: [jackson-dev] Re: Opinions on `jackson-databind` PR #1681 ("can not" -> "cannot" in exception messages)

2017-07-09 Thread Tatu Saloranta
ne 27, 2017 at 6:29:44 PM UTC+2, Tatu Saloranta wrote: >> >> Quick question: I would appreciate quite sanity check on this PR >> >> https://github.com/FasterXML/jackson-databind/pull/1681 >> >> which proposes to change wording of comments and exception messages so

Re: [jackson-user] Numeric key serialization in YAML

2017-07-11 Thread Tatu Saloranta
On Wed, Jul 5, 2017 at 2:59 PM, Ron wrote: > Hello, > > In YAML, a numeric key actually has a type of a number and not a string. > To avoid ambiguity when converting YAML and JSON, numeric keys need to be > quoted to be considered strings. > In fact, you can have both a quoted and unquoted numeric

Re: [jackson-user] CBOR parsing: how to extract byte array from CBOR encoded in ruby (using cbor-ruby)

2017-07-20 Thread Tatu Saloranta
How are you accessing the data? If using databinding, it should be as simple as declare type to be `byte[]` for the field or Map value, like: class POJO { public Map stuff; } and it'll work. The other part is that Ruby side must encode things appropriately; either as binary value, or, if as

[jackson-user] Last call for bug fixes for 2.9.0 -- release by end of this week (and July 2017)

2017-07-26 Thread Tatu Saloranta
Ok it is finally happening: Jackson 2.9.0 will be released during this week, before end of July. All the features I thought as must-haves are in, as well as blocking fixes. Or at least I think this is the case for core components (annotations, streaming, databind). I have also tried to go over othe

[jackson-user] Jackson 2.9.0 released

2017-07-30 Thread Tatu Saloranta
We finally have Jackson 2.9 release out: core components, standard modules (except Scala module which should follow soon) all should be in Maven Central. Full release notes can be found at: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9 I will try to send a better summary of new f

Re: [jackson-user] Expected behavior of JsonInclude.NON_EMPTY with Maps?

2017-08-01 Thread Tatu Saloranta
Ok: this is where distinction between `value` and `content` differ, for Maps (and referential types). I think your question is similar to one I had when deciding earlier that 2 properties are needed. Basic `value`, like @JsonInclude(Include.NON_EMPTY) would only exclude "map" itself, and only if

Re: [jackson-user] Expected behavior of JsonInclude.NON_EMPTY with Maps?

2017-08-01 Thread Tatu Saloranta
Tuesday, August 1, 2017 at 2:14:06 PM UTC-7, Tatu Saloranta wrote: >> >> Ok: this is where distinction between `value` and `content` differ, >> for Maps (and referential types). I think your question is similar to >> one I had when deciding earlier that 2 properties are

Re: [jackson-user] JsonUnwrapped & camel cased properties

2017-08-02 Thread Tatu Saloranta
On Mon, Jul 31, 2017 at 3:34 PM, Drpbxa wrote: > When you annotate a property with @JsonUnwrapped you can set a prefix > attribute: > > @JsonUnwrapped(prefix="camel") > MyObject obj; > > If MyObject has a property named "casedProperty", the json key will be named > "camelcasedProperty" instead of

Re: [jackson-user] JsonUnwrapped prefix & camel case properties

2017-08-02 Thread Tatu Saloranta
On Mon, Jul 31, 2017 at 3:28 PM, Drpbxa wrote: > When you annotate a property with @JsonUnwrapped you can add a prefix > attribute. For example: > > @JsonUnwrapped(prefix="camel") > MyObject obj; > > If MyObject has a property "casedProperty", the json key will be > "camelcasedProperty" instead of

Re: [jackson-user] XML deserialization : same localname but differents namespaces.

2017-08-02 Thread Tatu Saloranta
On Thu, Jul 20, 2017 at 6:06 AM, Adrien Quentin wrote: > Hello, > > I'm trying to use jackson deserialization to parse and map java object. > Work fine except when the xml contains two same local names in differents > namespaces, like this : > > > > > > > > > Borehole description > > http://ww

Re: [jackson-user] Jackson custom serializers

2017-08-09 Thread Tatu Saloranta
On Tue, Aug 8, 2017 at 4:03 PM, Matteo wrote: > Hello! > > I'm trying to write a custom serializer that can transform the following > structure > > { > "a": { > "@context": "context-a", > "aKey": "aValue" > }, > "b": { > "@context": "context-b", > "anoth

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

2017-08-09 Thread Tatu Saloranta
mination logic will work in this case as well. Is this > correct? Yes, that should work. -+ Tatu +- > > On Monday, 6 March 2017 19:44:56 UTC-5, Tatu Saloranta wrote: >> >> On Fri, Mar 3, 2017 at 3:16 AM, Jothisubaramaniam P >> wrote: >> > There is one set

Re: [jackson-user] Jackson custom serializers

2017-08-10 Thread Tatu Saloranta
`findTypeValueSerializer()`) are relevant for polymorphic handling. Regardless of which method you call, use of resulting serializer should be the same as in your original example. -+ Tatu +- > > Thank you! > > matteo > > On Wednesday, August 9, 2017 at 9:44:59 PM UTC+2, Tatu Salorant

Re: [jackson-user] Missing jackson-modules-java8 artifacts in Maven central repo

2017-08-10 Thread Tatu Saloranta
On Thu, Aug 10, 2017 at 9:49 AM, Chris Slater wrote: > It looks like the jackson-modules-java8 jars are missing from the Maven > central repo. Only the pom files are there. > > https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-java8/2.9.0/ > > (Other versions are

Re: [jackson-user] Completely disabling Jersey 2 + Jackson 2 auto-registration

2017-08-11 Thread Tatu Saloranta
There are 2 variants of Jackson JAX-RS providers: http://repo1.maven.org/maven2/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.0/ and what you'd want is "no-metainf" one -- it does not include SPI for indicating as provider. I think you can specify that with Maven "classifier" for de

Re: [jackson-user] Jackson serialization

2017-08-11 Thread Tatu Saloranta
Since you are using default typing, this is how things work -- why would you not expect type information? Perhaps you could share your object model and explain why you think typing should not affect contents the way it does. -+ Tatu +- ps. In future when asking questions about "why does X happen

Re: [jackson-user] Alternative to AnnotatedMember#getContextClass (of v2.5) in v2.8

2017-08-15 Thread Tatu Saloranta
On Tue, Aug 15, 2017 at 4:10 PM, Jama A wrote: > I used > `com.fasterxml.jackson.databind.introspect.AnnotatedMember#getContextClass` > in my project to get actual sub-class name that field has a value. But it > was removed in this commit [Starting work on ensuring proper resolution of > member ty

Re: [jackson-user] Alternative to AnnotatedMember#getContextClass (of v2.5) in v2.8

2017-08-15 Thread Tatu Saloranta
.5, there're used to be >> annotatedMember.getContextClass(); which used to return Bar class for the >> fields that declared in the parent class. But now I don't have that method >> in 2.8, but the only option I see is that >> annotatedMember.getDeclaringCla

Re: [jackson-user] Json deserialization using jackson for java.lang.object returns java.lang.ArrayList sometimes

2017-08-16 Thread Tatu Saloranta
The very first suggestion, as always, is to make sure you use the latest patch for minor version: in this case, 2.8.9. Getting an `ArrayList` is a sign that type information is not available (it is what is bound for `java.lang.Object` valued properties, from JSON Array). But in this case I do not

Re: [jackson-user] Calling default deserializers from customer deserializer

2017-08-18 Thread Tatu Saloranta
On Fri, Aug 18, 2017 at 1:32 PM, Vladimir wrote: > > I implement the ResolvableDeserializer within my custom deserializer, which > gives me the reference to the default JsonDeserializer. > Id like to invoke the default deserializer on the "Jail" JsonNode to return > to me a Jail object > > public

Re: [jackson-user] Calling default deserializers from customer deserializer

2017-08-18 Thread Tatu Saloranta
from `deserialize()`, or from initial call to `resolve()`. -+ Tatu +- > > > > On Friday, August 18, 2017 at 4:38:24 PM UTC-4, Tatu Saloranta wrote: >> >> On Fri, Aug 18, 2017 at 1:32 PM, Vladimir wrote: >> > >> > I implement the ResolvableDeserializer with

Re: [jackson-user] Calling default deserializers from customer deserializer

2017-08-18 Thread Tatu Saloranta
ndNonContextualValueDeserializer()` (difference being whether you have access to `BeanProperty`, which is made available in `createContextual()`, but not during `deserialize()`). And with that you can delegate to deserializer you get. -+ Tatu +- > > > On Friday, August 18, 2017 at 6:28:40

Re: [jackson-user] Is there any documentation on the new non-blocking JSON parser in 2.9.0?

2017-08-20 Thread Tatu Saloranta
I hope others have something, but for now examples from `jackson-core` tests may have to suffice. Or, anything that describes how `aalto-xml` non-blocking mode works should be highly applicable. In nutshell, the only differences are: 1. You must construct non-blocking parser with new method `crea

Re: [jackson-user] PropertyBasedCreator extension?

2017-08-20 Thread Tatu Saloranta
Short answer is that this class has not been designed as an extension point, and was made `final` to prevent anyone from attempting to do that. I am not questioning that ability to extend could be useful; it just hasn't been ready for such usage (... whereas some other classes are non-final even if

Re: [jackson-user] Is there any documentation on the new non-blocking JSON parser in 2.9.0?

2017-08-21 Thread Tatu Saloranta
e guaranteed (... in which case non-blocking may not be valuable anyway) they should not be used. -+ Tatu +- > > > On Sunday, August 20, 2017 at 5:11:48 PM UTC-7, Tatu Saloranta wrote: > >> I hope others have something, but for now examples from `jackson-core` >> tests may hav

Re: [jackson-user] Re: Calling default deserializers from customer deserializer

2017-08-23 Thread Tatu Saloranta
On Sun, Aug 20, 2017 at 1:48 PM, Vladimir wrote: > > Thank you for the response once again. > > As you suggested I am using "findNonContextualValueDeserializer" to locate > deserializer for a given type I expect. > > JsonNode eventNode = jsonTree.get("event"); > > ctxt > > .findNonContextualValueD

Re: [jackson-user] Testing for a MixIn containing unknown properties.

2017-08-25 Thread Tatu Saloranta
On Fri, Aug 25, 2017 at 9:45 AM, 'Stephen Murby' via jackson-user wrote: > I have just implemented some read only fields on an api using MixIn to > enforce the rename and also the ignore on deserialisation. Like this > > @JsonProperty(access = JsonProperty.Access.READ_ONLY, value = > "_privateProp

Re: [jackson-user] JAXB / Jackson XML to Json conversion issue - custom Integer binding.

2017-08-25 Thread Tatu Saloranta
On Fri, Aug 25, 2017 at 3:36 AM, Anthony Roy wrote: > Hi all, > > I have googled this issue to death with no joy, so am trying on here... > > Here is the initial problem: > 1. I am using JAXB to generate a Java object model from a provided XSD. > 2. There are various integer fields in the schema.

Re: [jackson-user] Serialize Spring MVC

2017-09-05 Thread Tatu Saloranta
On Mon, Sep 4, 2017 at 4:00 AM, <269...@gmail.com> wrote: > Hello, > > I have Spring MVC application with asynchronious enpoints. > > @Entity > @Table > public class B { > > @Id > @GeneratedValue > private UUID id; > > @ManyToOne(fetch = FetchType.LAZY) > @JoinColumn(name = "a_

[jackson-user] Jackson 2.9.1 patch release out

2017-09-08 Thread Tatu Saloranta
After going through initial bug reports for 2.9.0 -- most of which were minor bugs (yay!) -- it was time to do the first patch. Full release notes are here: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9.1 (although note that some fixes were only listed for 2.8.10, so this is a sub

Re: [jackson-user] How to handle subclassing with an overridden field

2017-09-15 Thread Tatu Saloranta
On Thu, Sep 14, 2017 at 2:21 PM, David Herron wrote: > I'm writing a SpringBoot application where I'm creating a REST API from a > fairly complex object model that was created in UML. The guys who created > the UML defined several classes that inherit from other classes and in some > cases overri

Re: [jackson-user] Feature: Out of the box support for arbitrarily nested collection (de)serialization

2017-09-20 Thread Tatu Saloranta
On Wed, Sep 20, 2017 at 6:47 AM, 'tykefr' via jackson-user wrote: > I think I must be very dim, but I can't find the support for deserializing > arbitrarily nested collections. Serialization works fine in all cases. > And I've no problem with > > @JsonDeserialize(contentAs = FooImpl.class) >

Re: [jackson-user] Self Reference on User

2017-09-20 Thread Tatu Saloranta
Sounds like something to do with Hibernate's use of lazy loading, and serialization being triggered in a way that its Session is closed. I don't see anything in exception that suggests problem being related to parent/child (managed/back) reference handling. I have never used Hibernate myself so I c

Re: [jackson-user] @JsonTypeInfo not showing inside a list of generic type

2017-09-20 Thread Tatu Saloranta
On Wed, Sep 20, 2017 at 2:06 AM, Matthias wrote: > Hi, > > I have (approximately) the following code: > > @JsonAutoDetect > class Container { > private final List entries; > } > > @JsonAutoDetect > @JsonTypeInfo(property="_type", include=JsonTypeInfo.As.PROPERTY, > use=JsonTypeInfo.Id.NAME) >

Re: [jackson-user] Customizing deserializion based on the stack of context

2017-09-21 Thread Tatu Saloranta
On Thu, Sep 21, 2017 at 4:26 AM, Mikko Ahonen wrote: > Hello, > > I wish to create a default security policy in a very large system. > > My current approach is to come up with a deserialization configuration where > all JSON strings are sanitized in the following way: > - by default, all strings a

Re: [jackson-user] ObjectMapper.writeValue and primitive types

2017-09-21 Thread Tatu Saloranta
On Thu, Sep 21, 2017 at 11:06 AM, Andrea Bergonzo wrote: > Why `ObjectMapper.writeValue` serializes boxed primitive types (like `new > Integer(1)`) as a value "1" even if it is not a valid JSON and the docs > state "Method that can be used to serialize any Java value as > * JSON output"? > >

Re: [jackson-user] Self Reference on User

2017-09-21 Thread Tatu Saloranta
AM UTC+12, Tatu Saloranta wrote: >> >> Sounds like something to do with Hibernate's use of lazy loading, and >> serialization being triggered in a way that its Session is closed. I >> don't see anything in exception that suggests problem being related to >&g

Re: [jackson-user] Feature: Out of the box support for arbitrarily nested collection (de)serialization

2017-09-21 Thread Tatu Saloranta
Glad you got it working -- this is bit of a complex example, both due to generic typing (or lack thereof), and challenges in supporting nested type definitions for properties. One practical challenge is that while Annotations can refer to other Annotation values (in addition to Strings, Classes, En

Re: [jackson-user] Customizing deserializion based on the stack of context

2017-09-25 Thread Tatu Saloranta
On Thu, Sep 21, 2017 at 11:59 PM, Mikko Ahonen wrote: > On Thursday, September 21, 2017 at 10:54:29 PM UTC+3, Tatu Saloranta wrote: >> >> >> I think you want to have a look at `JsonGenerator.getCurrentValue()`, >> which is a short-cut for longer >> &g

Re: [jackson-user] JSON serialization and concurrency

2017-09-25 Thread Tatu Saloranta
On Mon, Sep 25, 2017 at 4:58 AM, Clément Poulain wrote: > Hi there, > > I have a REST API project based on Jersey (v2.22.1) where I'm using Jackson > (currently v2.8.9) to serialize my POJOs in HTTP answers. > I'm using @JsonProperty to force the usage of setters (required for my > needs) and I do

Re: [jackson-user] Cannot get proper package prefix for subclass using @JsonTypeInfo with MINIMAL_CLASS

2017-09-25 Thread Tatu Saloranta
What is missing here is piece of code to reproduce the results. Specific question is what is the serialization call, and type information that is given. There are couple of things that may go wrong with type erasure, if the polymorphic class is the root value (or is generic and needs type binding).

Re: [jackson-user] JsonSchemaGenerator to include min and max length of field in schema

2017-09-25 Thread Tatu Saloranta
+1 for trying that generator -- question of what to do with the current generator (module under FasterXML) is still open with respect to Jackson 3. There are enough problems (f.ex only supporting schema spec v3; lack of active maintainer) that I am contemplating deprecating it, as there are better

Re: [jackson-user] Possible to turn on 'ACCEPT_SINGLE_VALUE_AS_ARRAY' without coding?

2017-09-27 Thread Tatu Saloranta
No, Jackson does not use or support external configuration mechanisms. -+ Tatu +- On Wed, Sep 27, 2017 at 3:45 PM, Peter Smith wrote: > I think some third party software i'm using, Talend Open Studio, uses > Jackson to to mapping from xml to json. > > I'm wondering if it's possible to turn the

Re: [jackson-user] Issue serializing gereric type to XML

2017-09-27 Thread Tatu Saloranta
On Tue, Sep 26, 2017 at 3:41 AM, David Rodriguez Gonzalez wrote: > Hello, > > I am trying to serialize into XML this: > > public class Box { > > private T boxed; > } > > with the next specific class type: > > public class Person { > // fields > } > > but I get the next xml: > > > ...

Re: [jackson-user] Limitations on unwrapping XML?

2017-09-27 Thread Tatu Saloranta
Apologies for super slow reply here. I think that the change to (implied) attribute is accidental and resulting from some unexpected interaction between data-binding and xml generator, so it just happens to work that way I think. In case of unwrapping I would expect output as attribute not to work

Re: [jackson-user] Deserialization: Use setter with setXy() and withXy() together in same POJO

2017-09-29 Thread Tatu Saloranta
On Fri, Sep 29, 2017 at 8:51 AM, Paolo Bazzi wrote: > Hi all, > > Two questions regaring setter-lookup when deserializing a java POJO: > > > 1. How to enable the usage of setter using with-notation (builder-style) > instead of setXy() notation? > > static class StringPoJo { > private String

Re: [jackson-user] Question abut how to serialize a JsonNode to a string? ObjectMapper.writeValueAsString?

2017-10-02 Thread Tatu Saloranta
On Mon, Oct 2, 2017 at 11:39 AM, Xin Zhang wrote: > Is ObjectMapper.writeValueAsString is the best way to serialize a jsonNode? > I found it is slow. Could someone tell me that is there faster way to > serialize jsonNode? Yes, use of ObjectMapper (or ObjectWriter) is the supported way to serializ

Re: [jackson-user] Deserialization -is it possible to preserve instantiated final fields while populating their content

2017-10-02 Thread Tatu Saloranta
On Sun, Oct 1, 2017 at 5:41 PM, wrote: > I would like Jackson to populate content of final pre-instantiated fields > (of an embedded class) rather than instantiating them while loading their > owner class. > The reason is that the embedded class is to be used in many places but it > needs to be i

Re: [jackson-user] Hi guys, question about how to serialize a json object to string? ObjectMapper.writeValueAsString?

2017-10-02 Thread Tatu Saloranta
On Mon, Oct 2, 2017 at 11:24 AM, wrote: > Hi guys, question about how to serialize a json object to string? > ObjectMapper.writeValueAsString? Yes, for cases where you actually need a `String` that is a good method. In most cases it is better to directly serialize to `OutputStream` or `Reader`,

Re: [jackson-user] Deserialization: Use setter with setXy() and withXy() together in same POJO

2017-10-02 Thread Tatu Saloranta
On Mon, Oct 2, 2017 at 3:55 AM, Paolo Bazzi wrote: > Hi Tatu > > Thanks for your quick reply! > > Am Freitag, 29. September 2017 20:07:42 UTC+2 schrieb Tatu Saloranta: >> >> On Fri, Sep 29, 2017 at 8:51 AM, Paolo Bazzi wrote: >> > Hi all, >> > &

Re: [jackson-user] @JsonDeserialize(contentUsing = StackTraceElementDeserializer.class) ignored?

2017-10-13 Thread Tatu Saloranta
It probably won't matter too much, but as a general practice the very first thing you should do is to use latest patch version of the minor version: so instead of using 2.8.2, try 2.8.10. There are literally dozens of fixes within 8 patch releases and it is good to eliminate possibility of problem

[jackson-user] Jackson 2.9.2 patch version released

2017-10-14 Thread Tatu Saloranta
As per title, another patch for 2.9 is out. Fixes are listed on: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9.2 Number of fixes is relatively low for an early patch, as 2.9 seems to have had less teething trouble than most earlier 2.x releases. Upgrade is still recommended, but m

Re: [jackson-user] JSON serialization between Python and Java

2017-10-14 Thread Tatu Saloranta
On Sat, Oct 14, 2017 at 12:39 PM, Ryan Lubke wrote: > Hey Folks, > > Fairly new to Jackson, so if this is covered in the docs somewhere, my > apologies. > > I'm working on a POC to serialize objects between Python and Java using a > Python library called jsonpickle [1] > > Everything has been wor

Re: [jackson-user] Baffling "c.f.j.databind.JsonMappingException: Could not set field value" in Spring Boot app

2017-10-16 Thread Tatu Saloranta
That does seem odd, especially given that serialization by Jackson should not trigger use of any setter. Setters should only be used for deserialization. I also can not find any exception message within `jackson-databind`, or for Afterburner module (which seemed like a possibility). Would it be po

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