Hi Senduran,

AFAIK, There is no standard documentation on how to convert JSON to
x-www-form-urlencoded format as key-value pairs. As mentioned by Thusitha,
When the JSON is getting complicated converting it to the
x-www-form-urlencoded will also become complicated and may lead to
inconsistencies over different payloads. Therefore I too think, we should
use multipart/form-data in such situations.


Thanks.

On Thu, Jan 4, 2018 at 11:02 AM, Thusitha Thilina Dayaratne <
thusithathil...@gmail.com> wrote:

> Hi Senduran,
>
> IMHO x-www-form-urlencodedis for simple key value pairs. When the payload
> is complicated, we should use multipart/form-data instead of
> x-www-form-urlencoded content type. It can handle any complex complex
> scenarios that you mentioned.
>
> Thanks
> Thusitha
>
> On Wed, Jan 3, 2018 at 4:50 PM, Senduran Balasubramaniyam <
> sendu...@wso2.com> wrote:
>
>> Hi all,
>>
>> When an XML or a JSON is converted to  x-www-form-urlencoded format the
>> key value pair is created.
>> i.e
>>
>> <root>
>>   <key1>value1</key1>
>>   <key2>value2</key2>
>> </root>
>>
>> will be converted to key1=value&key2=value2
>>
>> similarly
>>
>> {"key1" : "value1", "key2" : "value2"} also get converted to
>> key1=value&key2=value2
>>
>> But what if the XML or JSON is not only having simple key value i.e
>> having an array or a child element
>>
>> for example,
>> <root>
>>   <key1>value1</key1>
>>   <key2>
>>     <subkey1>subvalue1</subkey1>
>>     <subkey2>subvalue2</subkey2>
>>   </key2>
>> </root>
>>
>> similarly for JSON like
>> {"key1" : "value1", "key2" : {"subkey1" : "subvalue1"}} or
>>
>> JSON with array
>> {"key1" : "value1", "key2" : ["arrayvalue1", "arrayvalue2"]}
>>
>>
>> Kindly let me know the available correct formats for
>> application/x-www-form-urlencoded content type.
>> Further it will be really helpful if you could point to a specification
>> or a standard document
>>
>> Thanks
>> Senduran
>>
>>
>> --
>> *Senduran *
>> Senior Software Engineer,
>> WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
>> Mobile: +94 77 952 6548 <077%20952%206548>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Vijitha Ekanayake
Senior Software Engineer*, *WSO2, Inc.; http://wso2.com/
Mobile : +94 777 24 73 39 | +94 718 74 44 08
lean.enterprise.middleware
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to