#1 2025-04-12 12:05:23

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 72

A little bit about TDocVariantData. FlattenFromNestedObjects ideas

TDocVariantData. FlattenFromNestedObjects whether can increase the transformation as follows:
{“arr":["a","b","c”]}  =>  {"arr.1":"a","arr.2":"b","arr.3":"c"}

Offline

#2 2025-04-13 12:22:27

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

Re: A little bit about TDocVariantData. FlattenFromNestedObjects ideas

Why not?

But I have started numbering the array items at 0, for consistency:
https://github.com/synopse/mORMot2/commit/7c6bab21fa31b

Offline

#3 2025-04-14 01:35:15

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 72

Re: A little bit about TDocVariantData. FlattenFromNestedObjects ideas

Thank you for your quick response, very great project.
Some apis (aliyun openapi) need to flatten the submitted object if it requires formdata, but it handles arrays with the sequence number of the first element being 1.
Is it possible to define a HandleArrayType=(hatNone=-1,hatZero=0,hatOne=1);
Change the array type of aHandleNestedArray to this HandleArrayType to determine the element sequence number based on the type

Offline

#4 2025-04-14 07:31:56

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

Re: A little bit about TDocVariantData. FlattenFromNestedObjects ideas

Offline

#5 Yesterday 01:51:19

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 72

Re: A little bit about TDocVariantData. FlattenFromNestedObjects ideas

perfect!Thank you for your work.

Offline

Board footer

Powered by FluxBB