Forum > Networking and Web Programming

fphttpapp request content empty

<< < (2/2)

Leledumbo:

--- Quote from: michoux on January 22, 2023, 11:02:49 am ---Another issue is that data which I receive is like this.

data%5B0%5D%5Bvip%5D=0&data%5B0%5D%5Bfirstname%5D=Mojca&data%5B0%5D%5Blastname%5D=Smolej&data%5B0%5D%5Bcountry%5D=Slovenija&data%5B0%5D%5BaccreditationNumber%5D=2023001000372&data%5B0%5

I am expecting JSON data but what I get is not JSON.
I try to speak with developers from this web site and they claim that they are sending proper JSON data.
Can I do something with above data, or I need to discuss with web developers to send me correct.

--- End quote ---
I can't tell, is this what req.Content spits? Or is it a result of your code decoding it? Certainly it is not JSON, it's a urlencoded instead:

--- Quote ---"the keys and values are encoded in key-value tuples separated by '&', with a '=' between the key and the value"
--- End quote ---
which is exactly what your string is, if you urldecode that %XX chars:

--- Code: ---data[0][vip]=0&data[0][firstname]=Mojca&data[0][lastname]=Smolej&data[0][country]=Slovenija&data[0][accreditationNumber]=2023001000372&data[0%5
--- End code ---
(yes, you gave truncated data)

Navigation

[0] Message Index

[*] Previous page

Go to full version