Rick

Rick
Rick

Sunday, September 14, 2014

Added pretty print JSON to Boon

    puts(Maps.asPrettyJsonString(map));
    puts(Boon.toPrettyJson(map));
Boon.toPrettyJson works with Set, Map, instances, etc.

(
)
Maps.asPrettyJsonString
BeanUtils.asPrettyJsonString (can pass custom mapper)
Lists.asPrettyJsonString 
Sets.asPrettyJsonString
Most people will want to use Boon.toPrettyJson
I am sure there are bugs, but it works mostly now. More testing needed of course.
{
    "name" : "Rick",
    "age" : 45,
    "wife" :         {
            "name" : "Diana"
        },
    "children" : [        {
            "name" : "Whitney"
        },        {
            "name" : "Maya"
        },        {
            "name" : "Lucas"
        },        {
            "name" : "Ryan"
        },        {
            "name" : "Noah"
        }],
    "fruit" : ["apple","orange","strawberry"]
} 

No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training