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

Read and write log files where each entry is in JSON format #32

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 4 comments
Closed

Comments

@GoogleCodeExporter
Copy link

Perhaps Gson would be useful for reading and writing logs where each entry
is in JSON format?

I haven't looked closely, but it appears that Gson won't emit a newline
when serializing to a file.  If this is something that Gson could
guarantee, then we could use newlines as record separators and make each
log entry a JSON object, and also use GSon to iterate over a log file and
deserialize each line into an object.

Original issue reported on code.google.com by bslesinsky on 15 Aug 2008 at 3:39

@GoogleCodeExporter
Copy link
Author

Yes, by default, Gson uses compact formatting, eliminating all white-space so it
should never write a new line. 

Original comment by inder123 on 15 Aug 2008 at 6:10

@GoogleCodeExporter
Copy link
Author

Closing the bug since this was a question, not an issue. The best place to post 
such
questions is the Google group for Gson, 
http://groups.google.com/group/google-gson

Original comment by inder123 on 15 Aug 2008 at 6:12

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

Okay, but I think there is an issue: it's not documented that toJson() will 
return a
String in compact formatting.  Also, I don't think there's a formal definition 
of
what compact formatting means.

Original comment by bslesinsky on 15 Aug 2008 at 4:01

@GoogleCodeExporter
Copy link
Author

That is a good point, and we need to explain all the default settings used by 
Gson. I
have added it in r157 to the javadoc for the default constructor of Gson(). 

Original comment by inder123 on 15 Aug 2008 at 7:55

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant