Added json encoding options to json response
Merge pull request #3660 from GrahamCampbell/4.1-json

Allow Json Encoding Options To Be Set On The Json Response
Working on code style.
Merging and fixing conflicts.