jsonemacstextmatesublimetext2bbedit

How to indent JSON data inside of TextMate, Emacs, BBEdit, or Sublime Text 2?


[Update: 8 hours after this question was posted, the author of JSON bundle was notified of the issue and he fixed it.]

I have the following JSON data in a file application.json, shown at the end of this post, and I have used TextMate with the JSON bundle, Emacs, BBEdit, and Sublime Text 2 to properly indent it, but all seemed like they couldn't.

Both TextMate and Sublime Text 2 insisted that the first { should not be indented, and the first major issue was for the closing brace for "child": {. Both TextMate and Sublime Text 2 refused to align the } under the left side of "child": {. Emacs kept on indenting further and further for each line, and BBEdit didn't seem to have an re-indent function at all (could this be?).

Is there a way to properly indent the file, or are TextMate and Sublime Text 2 both doing the right thing for the JSON data?

[ 
{
    "settings": [ "master" ],
    "appPort": "8666",
    "specs": {
        "frame" : {
            "type" : "HTMLFrameMojit",

            "config": {
                "deploy": true,
                "child": {
                    "type" : "HelloWorldMojit"
                    },
                    "assets": {
                        "top": {
                            "css": [
                            "/static/HelloWorldMojit/assets/index.css"
                            ]
                        }
                    }
                }
            }
        }
        },
        {
            "settings": [ "environment:development" ],
            "staticHandling": {
                "forceUpdate": true
            }
        }
        ]

Solution

  • I just corrected this issue in the bundle, for 2.0 users the bundle should update within 24 hours with the correction.