DEV Community

Cover image for Day 15 – Sending JSON to Client - Learning Node JS In 30 Days [Mini series]
Muhammad Ali (Nerdjfpb)
Muhammad Ali (Nerdjfpb)

Posted on • Originally published at blog.nerdjfpb.com

Day 15 – Sending JSON to Client - Learning Node JS In 30 Days [Mini series]

Do you know we can send JSON object to the client side ?
And we mostly use JSON data to pass client side.

We’ll do it using res.end()

We need to create a server first. You can see it from day 12.

Alt Text

Now we can create an JSON object

Alt Text

Now change the Content-Type

Alt Text

We can send the data to frontend now using res.end(JSONObject)

Alt Text

JSON.stringify() A common use of JSON is to exchange data to/from a web server.

Called server using postman –
Alt Text

Can you send JSON data using node js now ?

You can see the graphical version here

Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !

You can read the old posts from this series (below)

Top comments (0)