-
-
Notifications
You must be signed in to change notification settings - Fork 819
Open
Labels
need-test-caseNeeds a test case (unit test or such) to proceedNeeds a test case (unit test or such) to proceed
Description
During serialization, when using a custom serializer, the JsonPointer is inconsistent when serializing the first element. Instead of having /myList/0
we get /myList
This happens because we enter this part of code : https://github.com/FasterXML/jackson-core/blob/2.17/src/main/java/com/fasterxml/jackson/core/JsonPointer.java#L212
The call stack looks like this, the Object received in my CustomSerializer.serialize
method is the first element of my array.
JsonPointer.forPath(JsonStreamContext, boolean) line: 215
JsonWriteContext(JsonStreamContext).pathAsPointer() line: 279
CustomSerializer.serializeWithType(Object, JsonGenerator, SerializerProvider, TypeSerializer)
IndexedListSerializer.serializeTypedContents(List<?>, JsonGenerator, SerializerProvider) line: 181
IndexedListSerializer.serializeContents(List<?>, JsonGenerator, SerializerProvider) line: 92
IndexedListSerializer.serialize(List<?>, JsonGenerator, SerializerProvider) line: 79
Additional info: the problem seems to be the _index of _writeContext of JsonGenerator instance which is -1 but should be 0 at that time.
Metadata
Metadata
Assignees
Labels
need-test-caseNeeds a test case (unit test or such) to proceedNeeds a test case (unit test or such) to proceed