If you're receiving the JSON text via an ajax call using jQuery, jQuery will deserialize it into an object graph for you. If you've received it in some other way and have it in a string, you can deserialize it with jQuery.parseJSON.
However, the JSON you've quoted is invalid, specifically this bit:
"content": nil
There is no nil keyword in JSON. You'll want to fix the server to either leave the key off entirely, or use null, or something else. Valid JSON is defined on the JSON website, and you can use http://jsonlint.com for handy validation (and formatting). It might also be useful to use content or contents consistently; currently the top level uses contents but the subordinate entries use content.
Once you have the object graph, it's a fairly simple matter of a recursive function, looping through the array entries and, for entries that can have nested content, calling itself again to loop through that. Something vaguely like this (live copy):
jQuery(function($) { display("Loading the JSON data"); $.ajax({ type: "GET", url: "/path/to/the/data", dataType: "JSON", success: function(data) { display("Got the data, rendering it."); $(document.body).append(renderContents(data.contents)); }, error: function() { display("An error occurred."); } }); function renderContents(contents) { var index, ul; // Create a list for these contents ul = $("<ul>"); // Fill it in $.each(contents, function(index, entry) { var li; // Create list item li = $("<li>"); // Set the text li.text(entry.filename); // Append a sublist of its contents if it has them if (entry.content) { li.append(renderContents(entry.content)); } // Add this item to our list ul.append(li); }); // Return it return ul; } function display(msg) { $("<p>").html(msg).appendTo(document.body); } });
"content": nil-- there is nonilin JSON).