newsapps/flask-tarbell — pull request #139 by wilbertom (2014-05-24 08:36:44+00:00)
Title: Render json files too

Hey Newsapps,

I know this isn't asked for but it helped me do cool stuff for a project. It makes tarbell also render json files. Example usage:

`_base/base.py`
```
...
from pymongo import MongoClient
...
def minus_k(d, k):
d.pop(k)
return d

blueprint = Blueprint('base', __name__)

client = MongoClient()
db = client['ant_farm']
soa_db = db['school_of_ants'']
data = [minus_k(row, '_id') for row in soa_db.find()]

@blueprint.app_context_processor
def inject_soadb():
return {'db': data}
...

```

`data.json`
```
{{ db|tojson }}

```

`app.js`
```
$.getJSON('/data.json', function(d) {
console.log(d);
});

```
This way I can have static json data and load it async with Javascript.