How about using the `json` filter instead? http://docs.shopify.com/themes/liquid-basics/output