fastify / fastify/fast-json-stringify

Use fast-json-escape for string serialization

Open
#612 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.7k
Forks
226
Avg merge
1d 59m
Merged PRs (30d)
3

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the issue has not already been raised

### Issue

@BridgeAR has a nice [fast-json-escape](https://github.com/BridgeAR/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](https://github.com/fastify/fast-json-stringify/blob/d662aeece0c47e1e6010e07df40080a61e0fec6b/lib/serializer.js#L157). However, we need to add some adjustments to support surrogate pairs escaping. @BridgeAR already has an implementation like we need [this](https://github.com/BridgeAR/safe-stable-stringify/blob/73a49c28d60663b3e4be6a6bd0eb95e83d173369/index.js#L57).

I created a [PR](https://github.com/BridgeAR/fast-json-escape/pull/3) 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.