Tuesday, 14 March 2017

How do I include an object in a query-string as is?

I need a query-string to be in the format:

brand=samsung&model={"type":"touch"}

I am using the in built query-string module in Node.js

How would I form my object in order to output the query-string above?

My current object looks like this:

{ brand: samsung, model: { type: 'touch' } }

Which returns a query-string in the format:

brand=samsung&model=

I need to form the query-string without altering the URL.



via KC M

No comments:

Post a Comment