Jackson 2.x has half-assed implementation of JsonNode.toString() which sort-of, mostly works, but:
- Not quite, because
- Implementation can not access standard
JsonGenerator, so it is implemented with a simple, non-complete, code-duplicating writers
At first the plan was to actually make toString() produce visibly non-JSON output, to make it obvious that proper way to serialize JsonNodes is to do use ObjectMapper.writeValueAsString() (or equivalent).
But with #2176 we have a better way: we can produce valid JSON with standard/vanilla settings.
This should be convenient for many "casual JSON" use cases, and would achieve the goals of:
- Valid JSON output, if it looks such
- No more code duplication