@JsonRawValue is intended for serialization-side only, since the reverse direction is a bit trickier to handle. In effect it was added to allow injecting pre-encoded content.
@Sid there is no way to do that AND tokenization both efficiently. To support pass-through of unprocessed tokens would require additional state-keeping, which makes "regular" parsing somewhat less efficient. It is sort of like optimization between regular code and exception throwing: to support latter adds overhead for former. Jackson has not been designed to try to keep unprocessed input available; it'd be nice to have it (for error messages, too) around, but would require different approach.
But I think a work-around for your specific case would be to specify type as 'java.lang.Object', since this should work ok: for serialization, String will be output as is, and for deserialization, it will be deserialized as a Map. Actually you might want to have separate getter/setter if so; getter would return String for serialization (and needs @JsonRawValue); and setter would take either Map or Object. You could re-encode it to a String if that makes sense.
I guess it would be possible to add support for reverse, although that would be quite awkward: content will have to be parsed, and then re-written back to "raw" form, which may or may not be the same (since character quoting may differ).
This for general case. But perhaps it would make sense for some subset of problems.
I had a different use case for this. Seems like if we don't want to generate a lot of string garbage in the deser/ser, we should be able to just passthrough a string as such. I saw a thread that tracked this, but it seems there is no native support possible. Have a look at markmail.org/message/