hmm, if you've serialized an object with the StudentId property then I think that it will be:
var studentId;
function(json) {
    if (json.length > 0)
        studentId = json[0].StudentId;
}
But if you're just returning the StudentId itself maybe it's:
var studentId;
function(json) {
    if (json.length > 0)
        studentId = json[0];
}
Edit: Or maybe .length isn't even required (I've only returned generic collections in JSON).
Edit #2, this works, I just tested:
var studentId;
jQuery.getJSON(url, data, function(json) {
    if (json)
        studentId = json;
});
Edit #3, here's the actual JS I used:
$.ajax({
    type: "POST",
    url: pageName + "/GetStudentTest",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    data: "{id: '" + someId + "'}",
    success: function(json) {
        alert(json);
    }
});
And in the aspx.vb:
<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetStudentTest(ByVal id As String) As Integer
    Return 42
End Function