httpsocket send json data "Request url is not well-formed"

Hello all,

I am a complete web noob, so please be gentle…

I am trying to send json data as part of a url. However, when I try to send I receive an Invalid Argument Exception.

dim url as text = getUpdateURL(gameID.ToText, turn.ToText, side.ToText, gameData, completing) Send("update", url)

In this example, “gameData” is a json file that has been converted to text like so:

gameData = xojo.Data.GenerateJSON(Save.getSaveData).EncodeBase64

the resulting gameData looks along these lines:

eyJCZWFjaEF2YWlsYWJsZSI6W3RydWUsZmFsc2UsdHJ1ZSx0cnVlLGZhbHNlLHRy dWVdLCJCZWFjaGhlYWQwIjo3MDIsIkJlYWNoaGVhZDEiOjgwMiwiQmVhY2hoZWFk MiI6OTAyLCJCZWFjaGhlYWQzIjoxMDAyLCJCZWFjaGhlYWQ0IjoxMTAzLCJCZWFj

I think the problem lies in converting the gameData json into a text format that can be sent, as omitting gameData allows the Send("update", url) to execute without an exception.

Can anyone let me know what I’m doing wrong?

try
The following example encodes UTF-8 text for transmission without line breaks

gameData = xojo.Data.GenerateJSON(Save.getSaveData).EncodeBase64(utf8text, 0)

Thanks Loannis!

That was it. Without line breaks it sends ok! Although, I was using Jason’s iOSKit for the EncodeBase64, so had to tweak slightly to be able to set the options.

Many thanks again Loannis!