At this point the POST request bodies look like: let body = {'someArray': encodeURIComponent(JSON.stringify( ["a", 1])), 'someNumber': So you can use the URLSearchParams object in this case also (described above). Copy. Serializing objects to Dictionary
It is an example URL. * You may already know about Postmans PM API for cleaner and more robust scripting. It is required but ignored (it is used for documentation purposes only). Add the following KEY-VALUE pair; First name: Harish; Last name: Rajora; Here, the first name in the field of some form (text field here) that is needed to be entered and Harish is its value i.e. To call the sample API from the screenshot posted at the top of this post in the HTTP Action, the form values must be encoded & the values be separated by ampersand. In some cases, a controller method wants to handle request body parsing by itself, such as, to accept multipart/form-data for file uploads or stream-line a large json document. Sending Post Request. Model binding requires a single object as input to be bound to the POST data, with each POST Form Parameters could be as form-data, x-www-form-urlencoded, or raw JSON. Youll need to write something like this - (Please refer the screenshots) This way you can post array using x-www-form-urlencoded.
ToKeyValue() method is the main work horse for my solution. Select form-data. Then this part of the content cannot be used in Parse JSON, because its type is clearly application / x-www-form-urlencoded and not JSON. Change the parameter data type or the method request format. I am not using / cannot use postman - I'm using a built-in workflow builder of a home made platform, thus the field where I'd input the payload/parameter is just a text box - I don't believe I need to manually URL encode special character, the builder should do it on its own when sending the API call. Space separated array or object values. Example 1: We create the nested JSON objects using JavaScript code.