#1 2015-10-13 08:18:18

hnb
Member
Registered: 2015-06-15
Posts: 291

Best way to handle configuration in JSON - merging two variants

Hi,

what is most proper way to merge two TDocVariantData variants into one?
First variant "A" is with default configuration, second variant "B" contains values loaded from *.json file (and some values can be omitted).

To perform right behavior I need to fill missing values inside "B" (by using "A"). How to do something like this? :

B.AddOrUpdateIfValueIsNull(A);

Last edited by hnb (2015-10-13 08:20:37)


best regards,
Maciej Izak

Offline

#2 2015-10-13 08:58:07

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

Re: Best way to handle configuration in JSON - merging two variants

I've introduced the TDocVariantData.AddOrUpdateObject method, with an optional OnlyAddMissing parameter.
With OnlyAddMissing=true, you should have what you need.

See http://synopse.info/fossil/info/1a07990d3b

Offline

#3 2015-10-13 13:16:56

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: Best way to handle configuration in JSON - merging two variants

Thanks! Works as expected smile


best regards,
Maciej Izak

Offline

Board footer

Powered by FluxBB