I'm sure this is possible in zf2 though I'm not all that familiar. Any I'm trying to replicate rails formats where if you make a request like:

/user/create:POST

The create method of the user controller is invoked with a default response of HTML.

However, this request:

/user/create.json:POST

Would return a json response for the state of the action.

Could someone point me to the ZF2 documentation for doing that?

Rails snippet:
Code Ruby:
  def create
 
   @classified = Classified.new
 
    respond_to do |format|
      if @classified.save
        format.html { redirect_to @classified, notice: 'Classified was successfully created.' }
        format.json { render json: @classified, status: :created, location: @classified }
      else
        format.html { render action: "new" }
        format.json { render json: @classified.errors, status: :unprocessable_entity }
      end
    end
  end

Thanks