#1 2024-09-19 18:45:32

RaelB
Member
Registered: 2010-08-04
Posts: 57

Service method returns encoded/garbled text on Lazarus

Hi,

Code snippet:
mormot service method returns base64 string on Lazarus

When visiting the url: http://localhost:11111/root/NotebookService.List

With Delphi returns:

{
  "result": [
    [
      {
        "ID": 9,
        "Title": "New Notebook 1",
        "GUID": "",
        "CurrentNote": 0
      },
      {
        "ID": 10,
        "Title": "New Notebook 2",
        "GUID": "",
        "CurrentNote": 0
      }, ...

With Lazarus (v3.4 fpc 3.2.2, installed with fpcupdeluxe) returns:

{"result":[["￰AA4GAAAAAAEAAAAAAAAADk5ldyBOb3RlYm9vayAxAAAAAAAAAAAAAgAAAAAAAAAOTmV3IE5vdGVib29rIDIAAAAAAAAAAAADAAAAAAAAAA5OZXcgTm90ZWJvb2sgMwAAAAAAAAAAAAQAAAAAAAAADk5ldyBOb3RlYm9vayA0AAAAAAAAAAAABQAAAAAAAAAOTmV3IE5vdGVib29rIDUAAAAAAAAAAAAGAAAAAAAAAA5OZXcgTm90ZWJvb2sgNgAAAAAAAAAAAA=="],200]}

I'm on Windows 10

Last edited by RaelB (2024-09-23 21:49:39)

Offline

#2 2024-09-19 20:47:36

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: Service method returns encoded/garbled text on Lazarus

Lazarus does not have rtti for records, so you should inform mormot about typeinfo
Check the function: TRttiJson.RegisterFromText

Offline

#3 2024-09-19 21:12:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Service method returns encoded/garbled text on Lazarus

Please follow the forum rules:

1) first make a minimal search in the forum.
This very same question has been asked a few days ago in the forum:
https://synopse.info/forum/viewtopic.php?id=6994
My response at that time still applies.

2) Do not put code in the forum thread itself.

Offline

#4 2024-09-20 22:36:14

rdevine
Member
Registered: 2014-02-20
Posts: 52

Re: Service method returns encoded/garbled text on Lazarus

For the best search results use Google with <keywords> site:synopse.info. The forum search can be unreliable and this approach has the advantage of also returning blog posts.

Offline

#5 2024-09-21 07:55:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Service method returns encoded/garbled text on Lazarus

If you search "lazarus record base64" in the engine, it finds the forum post directly.

Of course, Google search is better.

Offline

Board footer

Powered by FluxBB