Skip to content

Improve serializeJSON()#187

Open
fschaefer wants to merge 1 commit into
wso2:masterfrom
fschaefer:master
Open

Improve serializeJSON()#187
fschaefer wants to merge 1 commit into
wso2:masterfrom
fschaefer:master

Conversation

@fschaefer

Copy link
Copy Markdown
Contributor

This commit tries to improve serializeJSON() to get closer to rfc4627.
It includes a more proper quoting of strings and output of integers
instead of floats where appropriate.

Purpose

At the moment the serializeString() method replaces only a subset of control characters that are allowed in JSON, hence stringify() may not serialize to valid JSON.

Goals

Add a better string quoting, closer to rfc4627.

Approach

Add a quote() method that walks through the chars of a string and replaces all escapable chars to their quoted "\uXXXX" counterpart.

This commit tries to improve serializeJSON() to get closer to rfc4627.
It includes a more proper quoting of strings and output of integers
instead of floats where appropriate.
@CLAassistant

CLAassistant commented Aug 5, 2019

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

2 participants