#1 Re: mORMot 1 » _json not parsing » 2020-07-02 14:42:09

Thanks a lot for your help with this. The TDocVariantData works fine & i can do everything i need to now.Cheers.

#2 Re: mORMot 1 » _json not parsing » 2020-07-01 15:19:40

Sorry like i say i'm very new to all this. Don't really understand what you meant by late binding. I've now realised i can access the fields in the above way but they just don't show in the debug window for the reason shown.

#3 Re: mORMot 1 » _json not parsing » 2020-07-01 14:52:14

Hi thanks for the reply. The way you've described it above is how i expected it to work but when i did oVariant.AgencyId is just showed as a value of variant in the debug window not the actual value of the the agencyID.

I've put in this code which i think is what admin was suggesting:

TDocVariant.New(oVariant) ;
oVariant:= _JsonFast(sResponseBody);

& this to seems to work ok now.

#4 Re: mORMot 1 » _json not parsing » 2020-07-01 13:12:59

Yeh i very new to all this so i am a bit confused. So are you saying i need convert my variant type to a TDocVariant before i can access it?

#5 Re: mORMot 1 » _json not parsing » 2020-07-01 12:37:29

Thanks for quick reply. If i look at oVariant in debugger it just looks the same as the input string. If i do oVariant.AgencyID the result it shows is Variant

#6 mORMot 1 » _json not parsing » 2020-07-01 12:16:28

sihaynes65
Replies: 14

Hi, I'm very new to all this & am probably making an obvious mistake but i can't get the _JSON function to work correctly

I'm doing this in delphi 2007:

var   oVariant:Variant;
       sResponseBody:string

sResponseBody:='{"AgencyId":"ADAM002   ","AgencyName":"Adams agency4                                                                                       ","SqlUserName":null,"SqlPassWord":null,"Status":"A","Payslips":true,"AWR":true,"Ledger":false,"Timesheets":true,"FromEmail":"","Bespoke":null,"AgencyEmail":"adam@agency.com","ReplyEmail":"                                                                                                                                                                                                                                                             ","UserHash":null}'

oVariant:= _JsonFast(fResponseBody);

It doesn't crash but the oVariant just contains the unparsed JSON not the variant representation of it as i'd expect.

Can anyone see what i doing wrong here? Any help would be very much appreciated.

Board footer

Powered by FluxBB