Skip to content

(REVERTED) Change default for JsonWriteFeature.ESCAPE_FORWARD_SLASHES to be true for 3.0Β #1200

Closed

Description

@cowtowncoder

(follow-up to #507)

Now that we have added ability to easily force escaping of / let's make that default for Jackson 3.0 stream writers.

Activity

  1. added
    3.xIssues to be only tackled for some future 3.x version
    on Jan 23, 2024
  2. added a commit that references this issue on Jan 23, 2024
    d4e9457
  3. added this to the 3.0.0 milestone on Jan 23, 2024
  4. added a commit that references this issue on Jan 23, 2024
    a802536
  5. odrotbohm commented on May 15, 2025

    @odrotbohm

    Is it still an option to revert that change of default? Any kind of URL-like structure looking entirely different in the JSON output generated is likely to break millions of application clients that are not prepared to deal with the additional backslashes. I guess this could be mitigated on the integrator side, but I'm not sure if it's a good state of affairs, if half the world has to switch to the 2.x defaults through, for example, some reconfiguration which Spring Boot applies.

    Even more problematic: as this is a JsonWriteFeature, it cannot be reconfigured on a MapperBuilder obtained from an existing ObjectMapper instance.

  6. cowtowncoder commented on May 15, 2025

    @cowtowncoder
    MemberAuthor

    First things first: it is totally possible to change this, but for that I think we'd need a Poll Discussion: we've had some as you can see here:

    FasterXML/jackson-future-ideas#72

    so if you could start one similar to existing ones, that'd be the way to go.

    That said, the reason for changing (as per #507) is that many other tools (notably GSON) by default escape "/" for security reasons (inclusion in HTML, specifically). And any JSON tool that does not handle escapes properly is broken, so while I think this can lead to problems (like existing tests not counting on escaping and using textual comparison for JSON output), I don't think it should lead to processing issues (and/or if it does that is exposing bugs in tooling).

    Having said that, if community feels changing defaults is not desired, I am fine with that too. But just need to get some sort of validation, in form of Poll. :)

  7. cowtowncoder commented on May 15, 2025

    @cowtowncoder
    MemberAuthor

    (on Builder problem -- yes, "generic" MapperBuilder is not great. But note that if ObjectMapper being re-built is JsonMapper, builder will be of JsonMapper.Builder type, can be cast. Not clean but doable).

  8. cowtowncoder commented on Jul 22, 2025

    @cowtowncoder
    MemberAuthor

    NOTE!!!: There's now Poll requesting UNDOing this change.

    @odrotbohm ^^^

  9. cowtowncoder commented on Jul 23, 2025

    @cowtowncoder
    MemberAuthor

    ... definitely looks like "let's undo & keep defaults as they are" is getting votes.

  10. cowtowncoder commented on Jul 24, 2025

    @cowtowncoder
    MemberAuthor

    Decision: WILL revert (voting was 20 - 0 in favor of reverting; highest vote count of polls (still pretty limited polling of course but...))

  11. changed the title [-]Change default for `JsonWriteFeature.ESCAPE_FORWARD_SLASHES` to be `true` for 3.0[/-] [+](REVERTED) Change default for `JsonWriteFeature.ESCAPE_FORWARD_SLASHES` to be `true` for 3.0[/+] on Jul 24, 2025
  12. cowtowncoder commented on Jul 24, 2025

    @cowtowncoder
    MemberAuthor

    Done.

  13. odrotbohm commented on Jul 24, 2025

    @odrotbohm

    Thanks for considering, Tatu! πŸ™‡β€β™‚οΈ

  14. cowtowncoder commented on Jul 24, 2025

    @cowtowncoder
    MemberAuthor

    @cowtowncoder np. Should have opened a Poll when you brought this up. But better later than too late -- we are still pre-3.0.0!

  15. added 2 commits that reference this issue on Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssues to be only tackled for some future 3.x version

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions