Question · JavaScript and React course · Module 11: Data Fetching and APIs

JSON.stringify in POST Request

Why do we use JSON.stringify() to pass data in the body of a POST request?

Answer options

  • Because it compresses data before sending
  • Because fetch() does not serialize plain JavaScript objects - the object must be converted to JSON text
  • Because the server requires data in binary format
  • Because JSON.stringify() encrypts the data

You can check the correct answer by solving this task in the CodeWorlds game.