Defiant Example

HTML

<script src="http://defiantjs.com/defiant.js/dist/defiant-latest.min.js"></script>
<div id="output"></div>

JavaScript

var fbData0 = {
       "data": [
          {
             "id": "X999_Y999",
             "location": "New York",
             "from": {
                "name": "Tom Brady", "id": "X12"
             },
             "message": "Looking forward to 2010!",
             "actions": [
                {
                   "name": "Comment",
                   "link": "http://www.facebook.com/X999/posts/Y999"
                },
                {
                   "name": "Like",
                   "link": "http://www.facebook.com/X999/posts/Y999"
                }
             ],
             "type": "status",
             "created_time": "2010-08-02T21:27:44+0000",
             "updated_time": "2010-08-02T21:27:44+0000"
          },
          {
             "id": "X998_Y998",
             "location": "Los Angeles",
             "from": {
                "name": "Donald Steven", "id": "X18"
             },
             "message": "Where's my contract?",
             "actions": [
                {
                   "name": "Comment",
                   "link": "http://www.facebook.com/X998/posts/Y998"
                },
                {
                   "name": "Like",
                   "link": "http://www.facebook.com/X998/posts/Y998"
                }
             ],
             "type": "status",
             "created_time": "2010-08-02T21:27:44+0000",
             "updated_time": "2010-08-02T21:27:44+0000"
          }
       ]
    },
    res = JSON.search( fbData0, '//*[contains(*,"Tom")]' ),
    str = '';

    for (var i=0; i<res.length; i++) {
        str += res[i].location +': '+ res[i].from.name +'<br/>';
    }

    document.getElementById('output').innerHTML = str;