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

Multiline comments sometimes lost in serialization/deserialization cycles #36

Closed
Barteks2x opened this issue Feb 1, 2020 · 1 comment
Milestone

Comments

@Barteks2x
Copy link

Json object constructed like this:

JsonObject obj = new JsonObject();
JsonPrimitive p = new JsonPrimitive(42);
obj.put("thing", p, "this is a multiline\ncomment");

is then serialized to:

{ /* this is a multiline */ /* comment */ "thing": 42 }

Then deserializing it back into json object keeps only the last line of the comment.

@falkreon falkreon changed the title Some comments are lost after deserializing output of serializing multiline comments with JsonGrammar.builder().withComments(true).printWhitespace(false).build() Multiline comments sometimes lost in serialization/deserialization cycles Feb 3, 2020
@falkreon falkreon added this to the 1.2.1 milestone May 23, 2021
@falkreon
Copy link
Owner

The example you've posted serializes to

{
	/* this is a multiline
	   comment
	*/
	"thing": 42,
}

on the current staging version. I'll run a few more tests to make sure the multi-comment text deserializes correctly, and save those tests in case of regressions in the future.

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