#1 2022-10-03 10:00:56

Chaa
Member
Registered: 2011-03-26
Posts: 248

RawJson interface parameters

In client-server services via interfaces I used RawJson in mORMot 1.18, and it's transmitted "as is", without serialization.
But in mORMot 2 transmission of RawJson now changed.
Is that expected?

For example,

i = interface
  procedure m(s: RawJson);
end;

mORMot 1.18:

s := ' ["x"] '
i.m(s) -> ' ["x"] '

mORMot 2:

s := ' ["x"] '
i.m(s) -> ' "[\"x\"]" '

Offline

#2 2022-10-03 12:49:37

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

Re: RawJson interface parameters

I am not able to reproduce.

When I run https://github.com/synopse/mORMot2/commit/87c0f367
and debug into the transmitted JSON, I have the expected unescaped JSON.

Offline

#3 2022-10-04 04:44:51

Chaa
Member
Registered: 2011-03-26
Posts: 248

Re: RawJson interface parameters

ab wrote:

I am not able to reproduce.

My bad, sorry.
The real case is in MVC Web application (mormot.rest.mvc.pas).

i = interface(IMvcApplication)
  procedure m(s: RawJson);
end;

Query: http://localhost/root/m?s=["x"]
And in mORMot 1.18: ["x"]
In mORMot 2: "[\"x\"]"

May be using RawJson parameter in MVC Web App is not a good idea.

Offline

#4 2022-10-04 08:07:18

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

Re: RawJson interface parameters

RawJson was not properly supported on the URI.

Please try https://github.com/synopse/mORMot2/commit/b22dc378

Offline

#5 2022-10-04 08:29:17

Chaa
Member
Registered: 2011-03-26
Posts: 248

Re: RawJson interface parameters

Great, everything works now.
Thanks!

Offline

Board footer

Powered by FluxBB