JSON can have data represented in about 5 primitive data types: String, Number, Array, Boolean, and Null. So if you are using express, and you have a javascript object that you would like to send to the client as json, the data fields(or object properties) will be cast to any of the respective data types. In this case of the base64 it will be sent as a *String* type. Below is the example:
*JavaScript Object:* > > *Let user = new User({* > * username: 'some_username',* > * id: some base64 encoded value or variable**});* *To send it as JSON using express, * you would simply do the below(res being the request object of your express middle-ware): > *res.json(user).send();* This way the *payload *sent to the client will be *a JSON Object like below:* > > > > *{ "username": "some_username", "id": "YmFzZTY0IGRlY29kZXI"} * I hope this helps and good luck! :) On Friday, March 29, 2019 at 6:28:45 AM UTC+2, madana gopal wrote: > > Hi Team, > > We are trying to setup a http client and server (using express). We have > to send single post request with data having two parameters (param1 of type > string and param2 of type base64 data. What is the way to send this?. > Please share if we have snippet for this. > > Thanks. > > Regards, > Madan > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/0866b765-fbaf-4f01-8f88-96e7b03e268f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.