Conversation
nedtwigg
left a comment
There was a problem hiding this comment.
Great PR, this will definitely get merged in some form, thanks!
Two points:
-
I think most of the classes in
com.diffplug.spotless.json.gsoncan be made package-private rather than public. -
You are currently using lots of reflection. That is fine, and I'm happy to merge this PR as-is. But you might want to consider #524
Good point, done. Please note that I had to also put
Thank you, I completely missed this one. I could definitely deliver this as a future improvement, but would prefer not to with this PR. I'd like to use this on a corporate project as soon as possible. |
|
We should advertise the compile-only thing better, would #1129 have helped you?
Roger. I'll merge and release once CI completes. |
|
CI failed with a |
Head branch was pushed to by a user without write access
Yes, definitely. The contribution guide would be the best place for this info, that's where I looked for it as well.
Oops. sorry for that. Error fixed. |
|
Published in |
|
Out of curiosity, why not just use setPrettyPrinting? |
|
@ZacSweers We need to set a custom |
This PR adds support for JSON formatting using Google's Gson library.
Motivation:
simple, based on org.json) would make this hard to implement, as its internal representation for key-value pairs does not guarantee any order. See the following examples which demonstrate thatsimpledoes some kind of key ordering, but not alphabetical:Notes:
simplefor backwards compatibility.Change includes:
indentWithSpaces,sortByKeys,escapeHtml, andversionproperties