fabriciocolombo / delphi-rest-client-api

A Delphi REST client API to consume REST services written in any programming language.
Apache License 2.0
380 stars 182 forks source link

\ backslash in string property #45

Closed JasonColeyNZ closed 8 years ago

JasonColeyNZ commented 9 years ago

I have a string property in an object that has backslashes () in the property and this seems to cause problems.

At the server the posted object appears as null.

If the backslashes are removed the posted object is removed.

Is there anything I should be doing to resolve this problem?

I am using Delphi XE6, VS2013 Community

JasonColeyNZ commented 9 years ago

OK, I switched to using SuperObject as it appears there is a long time delphi bug with backslashes not being parsed correctly, so uploading now works fine.

But now I have an issue with the updates coming down, I get a marshalling error and am not sure what to do now to get this working? any ideas?

JasonColeyNZ commented 9 years ago

the server is a WebApi and ASP.NET 5.0 rest site, which worked fine before I switched to the SuperObject.

JasonColeyNZ commented 9 years ago

Here is the json coming down to the delphi client.

'{"Project":null,"TaskList":null,"Comment":null,"Attachment":[{"datamemo":"This note won''t get through.... or will it?\r\n\r\nc:\testing\paths\with\backslashes\and\more\","datatype":1,"attachmentid":"{3FF9130A-834B-409D-AF97-BDEBD6CFA519}","md5":"","objectid":"{3A0C5B72-8A4E-48C2-8898-C45945462287}","objecttype":1,"projectmemberid":"","size":0,"modifieddate":2415017.95833333}],"Tag":null,"Id":0,"Description":"","SessionID":""}'

fabriciocolombo commented 9 years ago

The backslashes must be escaped.

 c:\\testing\\paths\\with\\backslashes\\and\\more\\"
JasonColeyNZ commented 9 years ago

Yeah I spotted that this morning, this what is being received from the server, so I will troubleshoot this next