I want to convert an array of Place objects to json, I've been doing it like this:

```
var places = <%= @places.to_json.html_safe %>;

```

The only problem is that every place in the @places array has an associated tag list that doesn't get included. I'm using the acts\_as\_taggable\_on gem to handle tags, so to get the tag list for a place I need to say place.tag\_list.

What do I have to do to get the tag\_list included for each place in the javascript array? I think I'll need to write my own to\_json method but I don't know how.

EDIT

It turns out that this is easier than I realized. I was able to say this:

```
var places = <%= @places.to_json(:include => :tags).html_safe %>

```

The only problem is that this includes more information about each tag than I really need. Every tag has an id and name, what I really want is just a list with tag names in it.