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

Add support for JsonGenerator.Key #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rbygrave
Copy link

No description provided.

@@ -150,6 +150,18 @@ private JsonGenerator writeName(String name) {
return this;
}

private void writeName(Key name) {
writeComma();
final char[] escaped = name.toCharArray();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nb: char[] escaped includes the quotes

JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
}
writeName(name);
stack.push(currentContext);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could refactor extract these 4 lines as they are the same as the lines from writeKey(String name)

}

private static String quoteEscape(CharSequence string) {
StringBuilder builder = new StringBuilder();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same escape logic as JsonGeneratorImpl.writeEscapedString() but writes to the StringBuilder instead

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.

1 participant