#1 2022-08-06 14:03:53

ertank
Member
Registered: 2016-03-16
Posts: 163

mORMot2 - json operations

Hi,

I have an old project that I need to make some changes and additons. I am using mORMot 1 in that project for json handling and now I want to switch using mORMot2.
But, I could not find any example project or some information (even on this forum) to adapt my code. It is more than possible I overlooked at it.

There is ThirdPartyDemos\martin-doyle\03-MethodBasedServices example project which has very basic json handling and that is all I could find.

I do not know if having just "mormot.core.json" is enough in uses list.
TTextWriter.RegisterCustomJSONSerializerFromText() is something that I use in old project and I could not see how to use/convert it to mORMot2.
I am also not quite sure how to serialize/de-serialize arrays and regular json.

Any help is appreciated.

Thanks & Regards,
Ertan

Offline

#2 2022-08-09 06:41:12

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: mORMot2 - json operations

In mORMot2 I uses Rtti.RegisterFromText from mormot.core.rtti.pas - here is a live example for array of record

Offline

#3 2022-08-09 08:25:17

ertank
Member
Registered: 2016-03-16
Posts: 163

Re: mORMot2 - json operations

This was what I have been looking for.
Both name and unit change and I failed to find it in mORMot2 sources.

Thank you.

Offline

#4 2022-08-09 09:50:37

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

Re: mORMot2 - json operations

You are right, it was confusing.

Hope https://github.com/synopse/mORMot2/commit/091b2a36 will help in the future.

Sorry for the confusion.

Offline

#5 2022-08-09 21:52:40

ertank
Member
Registered: 2016-03-16
Posts: 163

Re: mORMot2 - json operations

A good reference for future.

Thank you.

Offline

Board footer

Powered by FluxBB