mjson
mjson copied to clipboard
Add method to write json to Writer
Apologies for the late response. Project was in a bit of hiatus, but will pick it up in a bit more active maintenance now. I think this could be useful, but I'd have some changes to suggest:
- The pattern for adding new methods is to throw
UnsupportedOperationExceptioninstead of declaring abstract methods. - Indentation is often very helpful when serialization JSON, so I would be nice to have that as an option. To make this and other options really optional, the method could be declared with a variable number of arguments:
write(Object...options)which would also open the door for other options in the future.
Let me know if you are interested in making these amendments?
And thanks so much for the effort! In general I'd very reluctant to be adding new methods to the API, I'd prefer to have some design for an "extended library" where other utiities could go, but this one comes up often enough and is very practical in APIs etc.