Skip to content
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

JSON.parse fails with tab in property name #897

Closed
mus65 opened this issue May 17, 2021 · 1 comment · Fixed by #898
Closed

JSON.parse fails with tab in property name #897

mus65 opened this issue May 17, 2021 · 1 comment · Fixed by #898
Labels

Comments

@mus65
Copy link
Contributor

mus65 commented May 17, 2021

Consider the following JavaScript file test.js:

JSON.parse("{\"abc\\tdef\": \"42\"}");

Note that the property name contains a \t . The following code will fail:

var engine = new Jint.Engine();
engine.Execute(File.ReadAllText(@"TestFiles\test.js"));

Exception:

Jint.Runtime.JavaScriptException: Invalid character in property name 'abc	def'
   at parse <anonymous>:1:1
   at <anonymous>:1:1

The same code works fine in Edge:

image

This only seems to affect property names, tabs in values work fine.

Version is latest beta v3.0.0-beta-2031

@lahma
Copy link
Collaborator

lahma commented May 17, 2021

Thanks for reporting, created #898 to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants