Jump to content
Sign in to follow this  
Stéphane Wierzbicki

How can I serialize a TFieldList into a JSON string ?

Recommended Posts



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. 



Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this