I have an issue with putting int in JSON. I have an integer where I need to save the error code which server returns me. The problem is that I have to parse it in JSONObject, but JSONObject takes only Strings, not integers. Here is an example what I’m trying to do:
int errorCode;
JSONObject ErrorCode;
ErrorCode = new JSONObject(errorCode);
Any suggestions how to solve that issue?
you can do this ; when you try to create your json object , use this :
and then when you try to parse it , you can use :