JSON pretty formatting in vim

Quick ad hoc command:

:%!python -m json.tool

For reusing and typing more update your `.vimrc` file with:

com! FormatJSON %!python -m json.tool

After this you should be able to use :FormatJSON command.

This would convert:

[{"classification":"emrfs-site", "properties":{"fs.s3.consistent.retryPeriodSeconds":"10", "fs.s3.consistent":"true", "fs.s3.consistent.retryCount":"5", "fs.s3.consistent.metadata.tableName":"EmrFSMetadata"}, "configurations":[]},{"classification":"spark", "properties":{"maximizeResourceAllocation":"true"}, "configurations":[]},{"classification":"spark-env", "properties":{}, "configurations":[{"classification":"export", "properties":{"PYSPARK_PYTHON":"/usr/bin/python3"}, "configurations":[]}]}]

into

[
    {
        "classification": "emrfs-site",
        "configurations": [],
        "properties": {
            "fs.s3.consistent": "true",
            "fs.s3.consistent.metadata.tableName": "EmrFSMetadata",
            "fs.s3.consistent.retryCount": "5",
            "fs.s3.consistent.retryPeriodSeconds": "10"
        }
    },
    {
        "classification": "spark",
        "configurations": [],
        "properties": {
            "maximizeResourceAllocation": "true"
        }
    },
    {
        "classification": "spark-env",
        "configurations": [
            {
                "classification": "export",
                "configurations": [],
                "properties": {
                    "PYSPARK_PYTHON": "/usr/bin/python3"
                }
            }
        ],
        "properties": {}
    }
]
Advertisements

Take it easy

tl;dr: I’m going less quality, more quantity.

I like to write. I write lots, but usually don’t publish it. Whenever I think about something and write it down, I then rethink what I thought and want to rewrite what I wrote. It takes me ages to write something very precise and something that I wouldn’t be immediately ashamed of. This blog was meant to be the place for that content, for things I wouldn’t quickly regret. And, although, I’m rather OK with the content, I’m deeply disappointed with the frequency. Thus: change.

This blog initially was meant to be my academical window. Something that when people look me up (for whatever reason), they’d see something over which I would have control. However, my view on World has yet again changed. Despite my passion for research and likeness for academia free-thinking┬ádiverse environment, I’ve decided to leave it. There is so much great research being done in industry and private sector that I think I’m shooting myself in foot by sticking only to that audience.

Plan for this blog is changing to present cool things that happen and fun stuff I’m working on. I enjoy working and I like to write. If the content is not up to standard quality, shame. But not having a content at all is just disgraceful. How can I show people what I’m working on, if I don’t show them anything at all.

In Python’s mantra: It’s easier to ask for forgiveness than for permission.