-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/pretty unescaped json #1493
base: develop
Are you sure you want to change the base?
Conversation
Maybe the flag |
There are definitely some places where we want the default slash-escaping: in particular, in places where the JSON is being rendered inside HTML, or in particular inside a script tag, as that's what prevents JSON containing a closing script tag from ending the element. |
I checked the different places, and see that only one place has issue, in job params. This is fixed above. In fact, the json creation shall be separated from the escaping. For tags included in json, inside a script, it's allowed by the w3c validator. |
The issue with embedding in a script tag isn't about tags or angle brackets, etc. per se, its just about the output containing a closing script tag specifically.
The preceding code will run that |
The json standard doesn't require to escape anything, except
"
,\
and control characters. But php and Zend escape many other characters by default : tags, ampersand, apostrophe and overall the slashes "/" and the unicode characters, making json unreadable in many cases, whereas it's designed to be readable by people and machines.So these commits fix this point in the most important cases. There are some other places to fix, but they are useful only for developers, so less important.
The last commit fixes the api output so it can be readable by people who don't have a json viewer in their browser (and of course it works fine in Next).