documentation-developer icon indicating copy to clipboard operation
documentation-developer copied to clipboard

REST: Unescape slashes in JSON examples

Open adriendupuis opened this issue 11 months ago • 0 comments

Question Answer
JIRA Ticket
Versions
Edition

JSON examples were mixing escaped and not escaped slashes. This PR unify them as not escaped.

ECMA-404 "The JSON data interchange syntax" 2nd edition, December 2017 states:

All code points may be placed within the quotation marks except for the code points that must be escaped: quotation mark (U+0022), reverse solidus (U+005C), and the control characters U+0000 to U+001F. […] \/ represents the solidus character (U+002F).

So escaping the slash (a.k.a solidus) is optional; it doesn't matter.

% echo '{ "slash": "\/" }' | jq                                                                                     
{
  "slash": "/"
}

jq understands it but considers it's not worth keeping it.

Checklist

  • [ ] Text renders correctly
  • [ ] Text has been checked with vale
  • [ ] Description metadata is up to date
  • [ ] Redirects cover removed/moved pages
  • [ ] Code samples are working
  • [ ] PHP code samples have been fixed with PHP CS fixer
  • [ ] Added link to this PR in relevant JIRA ticket or code PR

adriendupuis avatar Dec 03 '24 13:12 adriendupuis