Open Jonamaita opened 4 months ago
I have been testing my central system sending it a data transfer message. So, I sent a json with the data transfer message how below:
data = [{ "timestamp": str(datetime.utcnow()), "connectorId": 1, "vin": "1234567ADAD", }] data = json.dumps(data) request = call.DataTransferPayload( vendor_id="StarCharge", message_id="CarId", data=data, )
It should be noted that the data is serealized, so when use call.DataTransferPayload method the data will be seralized again remaining as follows:
data
call.DataTransferPayload
'"[{\\"timestamp\\": \\"2024-03-18 01:54:02.060142\\", \\"connectorId\\": 1, \\"vin\\": \\"1234567ADAD\\"}]"'
The data was double seralized, so when the central system will unserializes the data it will get a string object and not dict object.
string
dict
It is important to say that some industry loaders send a json in the data transfer message, so maybe the library should handle this case.
json
I can do a PR with a approach if this issue is accepted.
PR
I have been testing my central system sending it a data transfer message. So, I sent a json with the data transfer message how below:
It should be noted that the
data
is serealized, so when usecall.DataTransferPayload
method thedata
will be seralized again remaining as follows:'"[{\\"timestamp\\": \\"2024-03-18 01:54:02.060142\\", \\"connectorId\\": 1, \\"vin\\": \\"1234567ADAD\\"}]"'
The data was double seralized, so when the central system will unserializes the
data
it will get astring
object and notdict
object.It is important to say that some industry loaders send a
json
in the data transfer message, so maybe the library should handle this case.I can do a
PR
with a approach if this issue is accepted.