No support for JSON type with MySQL 8 ? lazarus / 16-Databases ---------------------------------------------------------------------- MarcP · 2024-06-03 06:10 Hi, With FPC version 3.2.2+dfsg-32 I'm connecting to a MySQL 8 database, however it seems to ignore a field if it's type is JSON. ( https://dev.mysql.com/doc/refman/8.0/en/json.html ) Accessing the field's name with query.FieldByName('MyJSONData').AsString results in a "field not found" exception. Listing all the fields in a request like this : 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 Query.SQL.Text := 'SELECT * FROM MyTable';    Query.Open;    try      for i := 0 to Query.FieldCount - 1 do        WriteLn('Field ', i + 1, ': ', Query.Fields[i].FieldName);    finally      Query.Close;    end; Will just ignore the JSON one. Is support planned, even if working only with a .AsString ? (If other people run into the same issue, I was able to get my data with this, but it's not pretty) : Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT JSON_UNQUOTE(JSON_EXTRACT(JSONData, "$")) AS JSONData Thanks for any help ! ---------------------------------------------------------------------- Zvoni · 2024-06-03 06:51 As far as i understood the official MySQL-Docs: Probably no support planned, since even MySQL doesn't ship an "official" JSON-Datatype when calling "mysql_fetch_field_direct" https://dev.mysql.com/doc/c-api/8.0/en/c-api-data-structures.html https://dev.mysql.com/doc/refman/8.4/en/json.html QuoteOptimized storage format. JSON documents stored in JSON columns are converted to an internal format that permits quick read access to document elements. When the server later must read a JSON value stored in this binary format, the value need not be parsed from a text representation. The binary format is structured to enable the server to look up subobjects or nested values directly by key or array index without reading all values before or after them in the document. That said: It's still a guess on my side without being able to actually directly test/debug what mysql_fetch_field_direct actually returns