Search code examples
jsonsublimetext3

Why is my JSON not working for my sublime text settings?


I do not code in JSON and I'm trying to configure some settings for Terminus on Sublime Text 3. Why isn't my code working? I suspect it has something to do with the colons because they appear to be a different color than on the README page. Thanks in advance!

[
    "default_config": {
        "linux": null,
        "osx": "PowerShell",
        "windows": null
    },

    "preserve_keys" : [
        "ctrl+k",
        "ctrl+p",
        "ctrl+z",
        "ctrl+c",
        "ctrl+v",
        "ctrl+x"
    ],

    "theme": "default"
]

Solution

  • You should replace [ ] with { } like that:

    {
        "default_config": {
            "linux": null,
            "osx": "PowerShell",
            "windows": null
        },
    
        "preserve_keys" : [
            "ctrl+k",
            "ctrl+p",
            "ctrl+z",
            "ctrl+c",
            "ctrl+v",
            "ctrl+x"
        ],
    
        "theme": "default"
    }
    

    If you want to store data using key value, you have to use { }. If you want to store data in json as an array, you have to use [ ]. This is the difference which made you an error.


    Here's a good tutorial that you can use: https://www.digitalocean.com/community/tutorials/an-introduction-to-json

    It's all preety simple