Json - send int


I need to send an int field in a JSON string, but even adding toInt() to the string variable, it still sends a String, I think I might be doing something wrong but I don't know what it is:

jsonAtualizadoB = "{\"" + numeroBooking + "\":{\"status\":\"Shipped\",\"companyId\":\"001\",\"shippedDateStr\":\"" + updateDate + "\",\"shippedOpenType\":\"" + openType + "\",\"bookingNumber\":\"" + numeroBooking + "\",\"placeName\":\"" + receivedData + "\",\"lockerNumber\":\"" + lockers[door].id.toInt() + "\"}}";

Could someone help me?


It would be easier to help if you posted the entire code.
Please see the following article:

how can we guess what's lockers[door].id ?

also double check your quotes (write your JSON first exactly how it should looks like and then escape the quotes that are within a string. it's easy to get lost otherwise)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.