The method I use for encoding JSON data