forgot some json_encode calls from the example