Add jsonEncode directive

We'd like to be able to use this for embedding object data into javascript, as well as being able to output usable JSON objects when debugging.