Added conversion to proper JSON string if the request is to a .json page

I noticed that when sending a request to /messages/send-template.json the JSON object wasn't being properly created, and so I got a response error, saying that my JSON didn't contain an array in  "template_content"

I've added a quick check to see if the request is for a .json page, and if it is, to run the .to_json function on the object to properly convert it. This all seems to be working with the send-template method now