Strangely enough, even though a man (Antonio) could be facing a gruesome death, and later another man (Shylock) loses everything that is dear to him, including his faith, the mood of the court scene in Act 4 is intended to be rather comedic and ironic. Shakespeare relies on Shylock's and Portia's characterization to establish and maintain the mood. Shylock's refusal and rather clownish insistence on his unusual payment request is difficult for the court to take seriously. Additionally, the audience knows that the young doctor of letters is actually Portia; so her comments to Bassanio (her clueless new husband) are rather comedic, and her outwitting the savvy Shylock are ironic.
What modern audiences should see from this scene, however, is that while Shakespeare writes the courtroom incident with irony and a comedic tone (his audience would have laughed at Shylock's seemingly stubborn and pathetic nature and even at his downfall), the scene should not come across as funny today. A person's being forced to give up all his worldly goods to a daughter who betrayed him, being humiliated in front of the city's leadership and his archenemy (even when his enemy defaulted on a business deal), losing his only livelihood, and becoming sick at having to relinquish his religious faith because of others' prejudice are not experiences for others to laugh at.