Taking out timestamp var and second json_encode call.