Skip to content

Implement 'withoutEscapingSlashes' option and clean up string writing#1885

Merged
kperryua merged 1 commit intoswiftlang:experimental/new-codablefrom
kperryua:new-codable/non-escaping-slashes
Apr 8, 2026
Merged

Implement 'withoutEscapingSlashes' option and clean up string writing#1885
kperryua merged 1 commit intoswiftlang:experimental/new-codablefrom
kperryua:new-codable/non-escaping-slashes

Conversation

@kperryua
Copy link
Copy Markdown
Contributor

@kperryua kperryua commented Apr 7, 2026

Implement withoutEscapingSlashes option.

Motivation:

The withoutEscapingSlashes option had not been implemented or tested as yet.

Modifications:

Make the escape tables used in the algorithm properties of the JSONWriter, switching between the two options on init().

Also includes some opportunistic cleanup of the JSON string writing function.

Result:

The behavior is now implemented properly.

Testing:

Added a simple test case that demonstrates forward slashes NOT being escaped when withoutEscapingSlashes:true

@kperryua kperryua added the new-codable Related to new Swift (de)serialization APIs label Apr 7, 2026
@kperryua
Copy link
Copy Markdown
Contributor Author

kperryua commented Apr 8, 2026

Test failures are unrelated time zone issues or the extant Windows crash.

@kperryua kperryua merged commit ad819dc into swiftlang:experimental/new-codable Apr 8, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-codable Related to new Swift (de)serialization APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant