Skip to content

Conversation

@sreelakshmi-bruno
Copy link
Contributor

The formatter was preserving escaped forward slashes (\/) in JSON strings instead of decoding them to normal forward slashes (/). This caused URLs and file paths to display with escaped slashes, making JSON output harder to read and inconsistent with JSON.stringify behavior.

Fix: Added handling for \/ escape sequences in the scanString() function to decode them to /, matching JSON.stringify behavior.

Changes

  • Added FORWARD_SLASH constant (character code 47)
  • Updated JSDoc description
  • Added test cases covering this scenario

Before & After Example

Example

// Input
{"url":"https:\/\/example.com\/api\/v1"}

// Before
{
  "url": "https:\/\/example.com\/api\/v1"
}

// After
{
  "url": "https://example.com/api/v1"
}

@sreelakshmi-bruno sreelakshmi-bruno changed the title decode forward slash Decode forward slash Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants