Question: I'm just starting out with AJAX, trying to use JQuery's $.getJSON function (or any related, ie $.load(), $.ajax(), etc). I have a JSON file with a structure something like this:

```
[
    {
        "id": 1,
        "email": "user@domain.com",
        "password": "password"
    },
    {
        "id": 2,
        "email": "one@two.com",
        "password": "password"
    }
]

```

How can I call a GET on this JSON file (let's call it users.json) for a user with a specific email? I thought it would be the second paramter in $.getJSON, but that seems to just return the whole tree.

Thanks!

Answer: 
Short answer - you can't do this directly with AJAX. jQuery can extract portions of HTML and XML documents, but not JSON.

Easiest answer - retrieve the entire object (you have to, anyway) and use [jsonpath](https://code.google.com/p/jsonpath/) to get the structure you want

Longer answer - retrieve the entire object, and traverse it yourself to get the object you want

Best answer - make the email address a parameter to whatever script produces the json and have the server only return the data you want.
Once the JSON is parsed, you pass it to a callback function - then you can manipulate that array however you need.

You'll probably want some custom code:

```
$.getJSON(myURL, function(data) {
    /* data is an array of objects */
    for (var i=0, j=data.length; i<j; i++) {
        if (data[i].email === some_value) {
            /* do something with data[i] */
        };
    };
});

```

<http://api.jquery.com/jQuery.getJSON/>