jackson-databind
jackson-databind copied to clipboard
Support prettifying of serializing json string with f.ex key and value different color
If this library possible in the future make key and value of json beauty different color like in apps postman.
jackson is not responsible for syntax highlighting of output.
Agree with @yawkat: such functionality would need to be done by some other tool, or by Jackson extension. I assume this would require adding terminal emulation characters (VT-100 etc) around content; something that "JSONP" style wrappers can do.
In fact I suspect this might be already doable, come to think of that, but my terminal emulation code knowledge is bit dated (I did write a Java terminal emulator once, but that was in late 1990s!).
Although... given that this is asking for separate styling for key and values, I think the combination to use would have to be something like:
- Use custom
PrettyPrinter
to inject terminal emulation codes - Use
JsonGenerator.writeRaw()
for actual forced writes of codes, outside of "regular" content itself
but I do think that is actually doable.
And... it sounds like someone could maybe create a Jackson Module
that allows doing this, with configurability of styling to use.
I just image if can do it.