Jump to content
Registration disabled at the moment Read more... ×
Sign in to follow this  
Stéphane Wierzbicki

How can I serialize a TFieldList into a JSON string ?

Recommended Posts

Hello

 

I would like to serialize a FieldDefs list.The idea is to let my user update a TFDMemTable fields list and save this list.

I tried to use the TJSON class (found in unit REST.JSON), for example, 

 

TJSON.ObjectToJsonString (FDMemTable1.FieldDefs);

This code fails with an stack overflow error (unit system, function UnicodeFromLocaleChars).

Do I have to build all this list from the scratch ? 

 

Btw, I'm using Delphi RIO 10.3

Share this post


Link to post

Looks like it saves the definition to me?

 

{"FDBS":{"Version":15,"Manager":{"UpdatesRegistry":true,"TableList":[{"class":"Table","Name":"FDQueryTenants","SourceName":"tenants","SourceID":1,"TabID":0,"EnforceConstraints":false,"MinimumCapacity":50,"ColumnList":[{"class":"Column","Name":"TENANTID","SourceName":"TENANTID","SourceID":1,"DataType":"WideString","Size":144,"Searchable":true,"FixedLen":true,"Base":true,"OInUpdate":true,"OInWhere":true,"OriginTabName":"TENANTS","OriginColName":"TENANTID","SourceSize":144},{"class":"Column","Name":"TENANTNAME","SourceName":"TENANTNAME","SourceID":2,"DataType":"WideString","Size":256,"Searchable":true,"Base":true,"OInUpdate":true,"OInWhere":true,"OriginTabName":"TENANTS","OriginColName":"TENANTNAME","SourceSize":256}],"ConstraintList":[],"ViewList":[],"RowList":[{"RowID":0,"Original":{"TENANTID":"00000000-0000-0000-0000-000000000001","TENANTNAME":"Initial tenant"}}]}],"RelationList":[],"UpdatesJournal":{"Changes":[]}}}}
 

Share this post


Link to post

Well, looks like you need to insert at least one record to get all the details. I've tried to only populate the field list without any data... Will look at this again. 

 

Thank 

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×