creating JSON object without using a list

I want to be able to create a JSON object so that I can access it like this.

education.schools.UNCC.graduation

Currently, my JSON is like this:

var education  = {
    "schools": [
        "UNCC": {
            "graduation": 2015, 
            "city": "Charlotte, NC", 
            "major": ["CS", "Spanish"]
        },
        "UNC-CH": {
            "graduation": 2012,
            "city": "Chapel Hill, NC"
            "major": ["Sociology", "Film"]
        }
    ],
    "online": {
        "website": "Udacity",
        "courses": ["python", "java", "data science"]
    }
};

When I go to Lint my JSON, I get an error message. I know I can reformat my object to access it like this (below), but I don't want to do it this way. I want to be able to call the school name, and not use an index number.

education.schools[1].graduation

Answers


Objects have named keys. Arrays are a list of members.

Replace the value of "schools" with an object. Change [] to {}.


Need Your Help

Tunnel any kind of TCP traffic through HTTP/s

tcp applet portforwarding http-tunneling big-ip

I am looking for a software to tunnel RDP or other binary TCP traffic through a HTTPS tunnel. Because many clients only have HTTP/S permitted (only port 80 and 443 open in the firewall).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.