Skip to content

Java - Jackson - How to NOT unescape &lt; to < character automatically when deserializing? #253

Answered by cowtowncoder
bangph asked this question in Q&A
Discussion options

You must be logged in to vote

My problem is that I am not sure I understand the request. But if I am right, you'd want to somehow disable XML parsing of content/sub-tree -- there is no way to do that. XML parsers do not really expose raw underlying undecoded content; they must parse documents. There's no way to get around that.
So it's not a question of annotations, it's that Stax XML parsers will always produce element/tag value1, CDATA for white space, element/tag randomXML and so on.
So if that is the request there is nothing we can do, unfortunately.

On output side, however, there is an annotation @JsonRawValue, which can be used to inject pre-encoded content direclty into output stream. So if you had content know…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@pjfanning
Comment options

@bangph
Comment options

@pjfanning
Comment options

@bangph
Comment options

Comment options

You must be logged in to vote
4 replies
@bangph
Comment options

@cowtowncoder
Comment options

Answer selected by bangph
@bangph
Comment options

@cowtowncoder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants