Hi all,
When I tried to retrieve the data from MongoDB through my mobile application , it is showing the error
"Failed to deserialize JSON data, could not convert the value to long".
I also changed the datatype of the corresponding structure Id to text from default long Integer, still it is showing error.
can anyone please help me to solve it?
Thanks.
What is the datatype of PetEquipmentItem.Id, it is probably set to Long Integer, and the data that is tried to save is text, hence the error:
Hi Lekshmy,
Without more detail it is not easy for someone to help you.
Basically you have to figure out how the JSON looks that you get from the MongoDB, and why it does not match on your OutSystems structure(s). Best is to look in Service Center error log, and look at the call stack, maybe it will point you to what part of the JSON cannot correctly be mapped.
Regards,
Daniel
Hi Daniel Kuhlmann,
Thank you so much for the reply.....
The error displaying as following..
I had changed the Id to Text rather than long integer , still showing error
I am trying with Atlas Mongo account,
At the displaying side , it is showing error in data type mismatch happening for JSON Text data and Structure ID long integer type, even it is showing error in changing the datatype to Text. Is there any solution to convert the JSON data .
Thanks
The error message mentions that you try to convert _Id which is a string to long. Given what you shared I cannot understand why you get that message. Could you share where you mapp the MongoDB data to your structure, are you using a data conversion function like TextToLongInteger?
Thank you ....
here is the logic of the home screen where the data is retrieved from mongo DB
Regards
Lekshmy
Thank you so much....
The data type of PetEquipmentItem.Id is given as long Integer at the beginning, I changed it to text in between when the error is thrown, but it was showing the same error, Now tried after clearing the DB it is working fine.