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

Use fast-json-escape for string serialization #612

Open
2 tasks done
ivan-tymoshenko opened this issue Feb 26, 2023 · 2 comments
Open
2 tasks done

Use fast-json-escape for string serialization #612

ivan-tymoshenko opened this issue Feb 26, 2023 · 2 comments

Comments

@ivan-tymoshenko
Copy link
Member

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

@BridgeAR has a nice fast-json-escape package that allows you to escape string for JSON format. It's a better implementation than ours because it doesn't have a fallback to the standard JSON.stringify that we have here. However, we need to add some adjustments to support surrogate pairs escaping. @BridgeAR already has an implementation like we need this.

I created a PR a few months ago, but it's still awaiting a response.

@mcollina What is the correct solution in this case? Should we copy the code and put in a license? From the other point of view, the code I want to copy is not a fresh idea. It's a strict implementation of the JSON spec.

@BridgeAR
Copy link

I just released v2.0.0 that supports surrogate pairs. While checking the code, I noticed that the JSON.stringify got much faster escaping strings by now than in Node.js versions <= 10. It is now better to use JSON.stringify directly for escaping values, in case that's needed for the string.

@ivan-tymoshenko
Copy link
Member Author

That you for releasing a new version and for the hint. I will check the default JSON.stringify performance for this case.

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

No branches or pull requests

2 participants