Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
2 posts Page 1 of 1
Prettify json by using a new tag.

Code: Select all
<cms:set my_json='{"Russia":{"Moscow":"cold","Sochi":"warm"}"India":{"Mumbai":"pleasant","Delhi":"moderate"},"Miami":"great","Utopia":["unknown","uncertain","finicky"]}' is_json='1' />

<cms:print_json json=my_json html='1' />


Result:
Code: Select all
{
    "Russia":{
        "Moscow":"cold",
        "Sochi":"warm"
    },
    "India":{
        "Mumbai":"pleasant",
        "Delhi":"moderate"
    },
    "Miami":"great",
    "Utopia":[
        "unknown",
        "uncertain",
        "finicky"
    ]
}
Tag updated. Now fine-prints in browser if parameter html is set to '1'. Much easier to copy-paste good-looking json.
2 posts Page 1 of 1
cron