use json_encode where possible
Merge pull request #1 from jplitza/master

use json_encode where possible