moved json_encode. Double Derp.