Hey All, With inspiration from Romain, I went ahead and wrote a Json serializer that can create short Json snippets that we can safely include in error messages. I.e. it is optimized to only write a specific number of bytes and then stop. The recursion is tightly controlled to stop early as well. You can see that code in this PR if you're curious:
- https://github.com/apache/johnzon/pull/84 A few thoughts on where we could go from here: - We can probably work this into more exception handling that currently doesn't print Json - We do have some existing exception handling calling toString on JsonValue instances we should update. For example: https://github.com/apache/johnzon/blob/v1.2.16/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java#L627 - The current default number of characters in a snippet is 50. We could potentially have a system property to allow users to get more. Thoughts? -David