Database table record to Json string. lazarus / 16-Databases ---------------------------------------------------------------------- BSaidus · 2025-10-09 18:37 Hello  . Is there any way in FPC/Lazarus to export a Table record to a Json string? Ex: Code: [Select]  // Table  ________________________________  | al_Name    | al_Address     | al_Active | |_______________________________ | | aa             | 32, street       | true        | |_______________________________ | After export I get:    {"al_Name": "aa", "al_address":"32, street", "al_Active","1"} I tried this : https://github.com/solussaude/dataset-serialize2, but, it hide the '_' on the fields name,  I.E the result is: Code: [Select]   {"alName": "aa", "aladdress":"32, street", "alActive","1"} Thank you. ---------------------------------------------------------------------- Thausand · 2025-10-09 20:12 Quote from: BSaidus on October 09, 2025, 08:37:19 pmI tried this : https://github.com/solussaude/dataset-serialize2, but, it hide the '_' on the fields name,  I.E the result is: Code: [Select]   {"alName": "aa", "aladdress":"32, street", "alActive","1"} result my: Code: [Select]{ "al_Name" : "John Doe", "al_Address" : "123 Elm St, Springfield", "al_Active" : true }, { "al_Name" : "Jane Smith", "al_Address" : "456 Oak St, Springfield", "al_Active" : false }, { "al_Name" : "Alice Johnson", "al_Address" : "789 Pine St, Springfield", "al_Active" : true }, { "al_Name" : "Bob Brown", "al_Address" : "321 Maple St, Springfield", "al_Active" : true }, { "al_Name" : "Charlie Davis", "al_Address" : "654 Cedar St, Springfield", "al_Active" : false }, { "al_Name" : "Diana Evans", "al_Address" : "987 Birch St, Springfield", "al_Active" : true }, { "al_Name" : "Ethan White", "al_Address" : "135 Willow St, Springfield", "al_Active" : true }, { "al_Name" : "Fiona Green", "al_Address" : "246 Spruce St, Springfield", "al_Active" : false }, { "al_Name" : "George Black", "al_Address" : "357 Ash St, Springfield", "al_Active" : true }, { "al_Name" : "Hannah Blue", "al_Address" : "468 Cherry St, Springfield", "al_Active" : true }, { "al_Name" : "Ian Gray", "al_Address" : "579 Dogwood St, Springfield", "al_Active" : false }, { "al_Name" : "Julia Red", "al_Address" : "680 Hawthorn St, Springfield", "al_Active" : true }, { "al_Name" : "Kevin Yellow", "al_Address" : "791 Larch St, Springfield", "al_Active" : true }, { "al_Name" : "Laura Purple", "al_Address" : "802 Fir St, Springfield", "al_Active" : false }, { "al_Name" : "Mike Orange", "al_Address" : "913 Poplar St, Springfield", "al_Active" : true }, { "al_Name" : "Nina Pink", "al_Address" : "024 Sycamore St, Springfield", "al_Active" : true }, { "al_Name" : "Oscar Teal", "al_Address" : "135 Walnut St, Springfield", "al_Active" : false }, { "al_Name" : "Paula Cyan", "al_Address" : "246 Chestnut St, Springfield", "al_Active" : true }, { "al_Name" : "Quinn Magenta", "al_Address" : "357 Acacia St, Springfield", "al_Active" : true }, { "al_Name" : "Rita Indigo", "al_Address" : "468 Mulberry St, Springfield", "al_Active" : false }, { "al_Name" : "Sam Violet", "al_Address" : "579 Almond St, Springfield", "al_Active" : true }] Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Serialize;var  LJSONArray: TJSONArray;begin  DBQuery.SQL.Text:='SELECT * FROM Tablet';  DBQuery.Open;  TDataSetSerializeConfig.GetInstance.Ca seNameDefinition:=TCaseNameDefinition.cndNone; // see readme.md  LJSONArray:=DBQuery.ToJSONArray; // export all records  DBQuery.Close;  writeln(LJSONArray.AsJSON);  LJSONArray.Free;end; ---------------------------------------------------------------------- BSaidus · 2025-10-09 20:36 Thanks, I indeed use it, I hacked then function Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TDataSetSerialize.DataSetToJSONObject(const ADataSet: TDataSet; const AValue: Boolean = True): TJSONObject;   // ....       LKey := LField.F ieldName;//TDataSetSerializeUtils.FormatCaseNameDefinition(LField.Fiel dName);  // .... to use the fields name without Formatting them. Thank you. ---------------------------------------------------------------------- BSaidus · 2025-10-10 12:32 Quote from: Thausand on October 09, 2025, 10:12:51 pmQuote from: BSaidus on October 09, 2025, 08:37:19 pmI tried this : https://github.com/solussaude/dataset-serialize2, but, it hide the '_' on the fields name,  I.E the result is: Code: [Select]   {"alName": "aa", "aladdress":"32, street", "alActive","1"} result my: Code: [Select]{ "al_Name" : "John Doe", "al_Address" : "123 Elm St, Springfield", "al_Active" : true }, { "al_Name" : "Jane Smith", "al_Address" : "456 Oak St, Springfield", "al_Active" : false }, { "al_Name" : "Alice Johnson", "al_Address" : "789 Pine St, Springfield", "al_Active" : true }, { "al_Name" : "Bob Brown", "al_Address" : "321 Maple St, Springfield", "al_Active" : true }, { "al_Name" : "Charlie Davis", "al_Address" : "654 Cedar St, Springfield", "al_Active" : false }, { "al_Name" : "Diana Evans", "al_Address" : "987 Birch St, Springfield", "al_Active" : true }, { "al_Name" : "Ethan White", "al_Address" : "135 Willow St, Springfield", "al_Active" : true }, { "al_Name" : "Fiona Green", "al_Address" : "246 Spruce St, Springfield", "al_Active" : false }, { "al_Name" : "George Black", "al_Address" : "357 Ash St, Springfield", "al_Active" : true }, { "al_Name" : "Hannah Blue", "al_Address" : "468 Cherry St, Springfield", "al_Active" : true }, { "al_Name" : "Ian Gray", "al_Address" : "579 Dogwood St, Springfield", "al_Active" : false }, { "al_Name" : "Julia Red", "al_Address" : "680 Hawthorn St, Springfield", "al_Active" : true }, { "al_Name" : "Kevin Yellow", "al_Address" : "791 Larch St, Springfield", "al_Active" : true }, { "al_Name" : "Laura Purple", "al_Address" : "802 Fir St, Springfield", "al_Active" : false }, { "al_Name" : "Mike Orange", "al_Address" : "913 Poplar St, Springfield", "al_Active" : true }, { "al_Name" : "Nina Pink", "al_Address" : "024 Sycamore St, Springfield", "al_Active" : true }, { "al_Name" : "Oscar Teal", "al_Address" : "135 Walnut St, Springfield", "al_Active" : false }, { "al_Name" : "Paula Cyan", "al_Address" : "246 Chestnut St, Springfield", "al_Active" : true }, { "al_Name" : "Quinn Magenta", "al_Address" : "357 Acacia St, Springfield", "al_Active" : true }, { "al_Name" : "Rita Indigo", "al_Address" : "468 Mulberry St, Springfield", "al_Active" : false }, { "al_Name" : "Sam Violet", "al_Address" : "579 Almond St, Springfield", "al_Active" : true }] Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Serialize;var  LJSONArray: TJSONArray;begin  DBQuery.SQL.Text:='SELECT * FROM Tablet';  DBQuery.Open;  TDataSetSerializeConfig.GetInstance.Ca seNameDefinition:=TCaseNameDefinition.cndNone; // see readme.md  LJSONArray:=DBQuery.ToJSONArray; // export all records  DBQuery.Close;  writeln(LJSONArray.AsJSON);  LJSONArray.Free;end;  Oops, Thank you! I didn't know that Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  TDataSetSe rializeConfig.GetInstance.CaseNameDefinition:=TCaseNameDefinition.cndN one; // see readme.md   is feasible. I got it. Thank you. ---------------------------------------------------------------------- Thausand · 2025-10-10 20:23 I not clear and sorry BSaidus. I read post you and think have problem: only have one record then I make solution and post. Then I read better you post and read have problem underscore. I search solution (and find) then I have make modify my post for fix underscore. I not tell I make modify. Sorry for confuse. This code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TDataSetSer ializeConfig.GetInstance.CaseNameDefinition:=TCaseNameDefinition.cndNo ne; // see readme.md   make fix undercore. There also be other cndXXX value and make other conversion (uppercase, lowercase, etc). Readme tell this is how make configuration for serialization and have many option and explain in readme: https://github.com/solussaude/dataset- serialize2/blob/master/README.md#configurations Good and have read it make solve problem for you