You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result := lSerializer.SerializeDataSet(Self, [], ncLowerCase);
Serializer.JsonDataObjects.TMVCJsonDataObjectsSerializer.DeserializeDataSet method, by default, will not lower case target datasets' field names (ncAsIs).
As a result, field names in serialized dataset string (which are lower cased due to ncLowerCase) are matched against target datasets' field names (which are not guaranteed to be lower cased due to ncAsIs). We have to explicitly specify ncLowerCase as last parameter of DeserializeDataSet method, otherwise deserialization might produce wrong result (only empty records are created).
If DataSet.Utils.AsJSONArray method used ncAsIs instead of ncLowerCase we wouldn't have to explicitly specify ANameCase argument when calling DeserializeDataSet. This would also be consistent with how AsJSONObject <> DeserializeDataSetRecord is functioning right now (both methods use ncAsIs).
The issue is pretty minor and this change might break existing code bases. It might be a good idea to include this tweak in 3.1 and mention it in breaking changes list. Happy Holidays 🎅
The text was updated successfully, but these errors were encountered:
DataSet.Utils.AsJSONArray method calls TMVCJsonDataObjectsSerializer.SerializeDataSet method with hard-coded
ncLowerCase
parameter.delphimvcframework/sources/MVCFramework.DataSet.Utils.pas
Line 127 in f64eebf
Serializer.JsonDataObjects.TMVCJsonDataObjectsSerializer.DeserializeDataSet method, by default, will not lower case target datasets' field names (
ncAsIs
).delphimvcframework/sources/MVCFramework.Serializer.JsonDataObjects.pas
Lines 97 to 98 in f64eebf
As a result, field names in serialized dataset string (which are lower cased due to
ncLowerCase
) are matched against target datasets' field names (which are not guaranteed to be lower cased due toncAsIs
). We have to explicitly specifyncLowerCase
as last parameter of DeserializeDataSet method, otherwise deserialization might produce wrong result (only empty records are created).If DataSet.Utils.AsJSONArray method used
ncAsIs
instead ofncLowerCase
we wouldn't have to explicitly specify ANameCase argument when calling DeserializeDataSet. This would also be consistent with how AsJSONObject <> DeserializeDataSetRecord is functioning right now (both methods usencAsIs
).The issue is pretty minor and this change might break existing code bases. It might be a good idea to include this tweak in 3.1 and mention it in breaking changes list. Happy Holidays 🎅
The text was updated successfully, but these errors were encountered: