Comments (8)
Hi, can you show the code please?
from delphimvcframework.
Hi!
Sure...
s := RESTResponse1.Content;
In the string 's' the floating point number is still in there, but if I parse it afterwards with
Obj := TJsonBaseObject.ParseUtf8(s) AS TJsonObject;
and ask for the floating point of the appropriate property
workingHours := Obj['data'].Items[I].F['workingHours'];
I only get for example 2 instead of 2,25?
from delphimvcframework.
Any idea!?
from delphimvcframework.
Very strange... I ran the compilation on a normal Windows 11. There it works, but on my Mac M2 with Parallels it does not work. It must have something to do with the operating system or Parallels. Any idea?
from delphimvcframework.
Can you post the JSON contained in s
?
from delphimvcframework.
'{"error":false,"message":"","data":[{"id":101,"personId":4,"date":"2023-10-15T00:00:00Z","allowanceCatalogId":77,"allowanceSurchargeNo":"63","heavy":5,"workingHours":2.5,"createdAt":"2023-10-16T11:30:11Z","updatedAt":"2023-10-16T11:30:11Z"},{"id":102,"personId":4,"date":"2023-10-15T00:00:00Z","allowanceCatalogId":47,"allowanceSurchargeNo":"39","heavy":6,"workingHours":2.5,"createdAt":"2023-10-16T11:32:12Z","updatedAt":"2023-10-16T11:32:12Z"},{"id":105,"personId":4,"date":"2023-10-15T00:00:00Z","allowanceCatalogId":10,"allowanceSurchargeNo":"10","dirt":9,"workingHours":2.25,"createdAt":"2023-10-16T15:00:55Z","updatedAt":"2023-10-16T15:00:55Z"}]}'
from delphimvcframework.
It really is a phenomenon. I have compiled the application for OSX ARM 64 and it works without problems. It must have something to do with Windows 11 ARM?
from delphimvcframework.
I don't have a Windows 11 ARM machine, however the following code works as expected in Windows 11 with Win32 and with Win64 target.
uses
JsonDataObjects;
{$R *.dfm}
procedure TForm13.Button1Click(Sender: TObject);
begin
var s := '{' +
' "error": false,' +
' "message": "",' +
' "data": [{' +
' "id": 101,' +
' "personId": 4,' +
' "date": "2023-10-15T00:00:00Z",' +
' "allowanceCatalogId": 77,' +
' "allowanceSurchargeNo": "63",' +
' "heavy": 5,' +
' "workingHours": 2.5,' +
' "createdAt": "2023-10-16T11:30:11Z",' +
' "updatedAt": "2023-10-16T11:30:11Z"' +
' }, {' +
' "id": 102,' +
' "personId": 4,' +
' "date": "2023-10-15T00:00:00Z",' +
' "allowanceCatalogId": 47,' +
' "allowanceSurchargeNo": "39",' +
' "heavy": 6,' +
' "workingHours": 2.5,' +
' "createdAt": "2023-10-16T11:32:12Z",' +
' "updatedAt": "2023-10-16T11:32:12Z"' +
' }, {' +
' "id": 105,' +
' "personId": 4,' +
' "date": "2023-10-15T00:00:00Z",' +
' "allowanceCatalogId": 10,' +
' "allowanceSurchargeNo": "10",' +
' "dirt": 9,' +
' "workingHours": 2.25,' +
' "createdAt": "2023-10-16T15:00:55Z",' +
' "updatedAt": "2023-10-16T15:00:55Z"' +
' }' +
' ]' +
'}';
var lObj := TJsonBaseObject.Parse(s) AS TJsonObject;
try
var workingHours := lObj['data'].Items[0].F['workingHours'];
ShowMessage(FloatToStr(workingHours)); // shows 2.5
finally
lObj.Free;
end;
end;
Do you have a different result?
from delphimvcframework.
Related Issues (20)
- Error when compile to Linux HOT 5
- Model with multiple Primary Key. HOT 4
- Swagger Param Body Array HOT 6
- ActiveRecord: TableName property readonly. HOT 9
- Querystring parameter is placed in context.request.body - but only on GET, DELETE and OPTIONS HOT 1
- Wrong MVCProduces attribute on TMVCJSONRPCController.GetPublishedMethodList
- FireDac Exception when running the articles_crud_server and articles_crud_vcl_client HOT 2
- [Question] Alternative to FireDac usage for RPC calls to DB Query HOT 1
- Where is the ObjectsMappers unit?
- MVCFramework.Signal not in package dmvcframeworkRT
- Use LIB suffix 120 in SwagDoc
- Apache routing broken HOT 2
- JsonToDataset error HOT 1
- Method EMVCActiveRecordNotFound.AfterConstruction Variable FHTTPStatusCode is undeclared HOT 1
- Can't compile in Delphi 10.2 MVCFramework.ActiveRecord; AddTableMap method HOT 4
- TMVCJsonDataObjectsSerializer : should calls "ADataSet.first" ? HOT 4
- TMVCJsonDataObjectsSerializer.JsonObjectToDataSet not recognises ftExtended DataType
- Possible wrong http error code when authenticating HOT 1
- JWT Add Algorithms: RS256, RS384 & RS512 HOT 2
- [treatment for socket error]: log the error for socket and treat the Indy's memory leak bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delphimvcframework.