[Lazarus] Base64 broken in json?

Michael Van Canneyt michael at freepascal.org
Sat May 30 10:48:54 CEST 2015



On Fri, 29 May 2015, "Leonardo M. Ramé" wrote:

> Hi, does anyone know if when adding a base64 encoded string to an TJsonObject 
> and calling AsJson method, the base64 is broken?

Normally not.

> I did try to decode (with base64 -d command) and I'm getting errors when 
> trying to decode the base64 string contained in the json. Btw, this is the 
> 1nst time I get errors, the file encoded is about 1.5mb.

If you write the json with AsJSON to file and try to decode this file, that will obviously not work.
You need to get the value of the member with the base64 using the AsString method. The result of 
AsString should be decodable

I have used JSON with Base64 repeatedly and never had problems.

Michael.


More information about the Lazarus mailing list