You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
Describe the bug
The bug happens on android when we want to get json data from server which send an integer
To Reproduce
Make a http get request from client, and send an integer json value from server.
Expected behavior
We expect no jsonexception raised
Screenshots
org.json.JSONException: Value 5100 of type java.lang.Integer cannot be converted to JSONArray
at org.json.JSON.typeMismatch(JSON.java:112)
at org.json.JSONArray.(JSONArray.java:98)
at org.json.JSONArray.(JSONArray.java:110)
at com.getcapacitor.JSArray.(JSArray.java:16)
at com.getcapacitor.plugin.http.HttpRequestHandler.parseJSON(HttpRequestHandler.java:312)
at com.getcapacitor.plugin.http.HttpRequestHandler.readData(HttpRequestHandler.java:239)
at com.getcapacitor.plugin.http.HttpRequestHandler.buildResponse(HttpRequestHandler.java:209)
at com.getcapacitor.plugin.http.HttpRequestHandler.request(HttpRequestHandler.java:401)
at com.getcapacitor.plugin.http.Http$1.run(Http.java:83)
at java.lang.Thread.run(Thread.java:919)
Desktop (please complete the following information):
Android emulator api 29
Smartphone (please complete the following information):
Android emulator api 29
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Hi, I the file "HttpRequestHandler.java", If I put at line 308 try {
return new JSArray(input);
}
catch(JSONException e2) {
return Integer.parseInt(input.trim());
}
It seems to work for Integer send by the server.
So may you put this piece of code in main branch of the code.
Describe the bug
The bug happens on android when we want to get json data from server which send an integer
To Reproduce
Make a http get request from client, and send an integer json value from server.
Expected behavior
We expect no jsonexception raised
Screenshots
org.json.JSONException: Value 5100 of type java.lang.Integer cannot be converted to JSONArray
at org.json.JSON.typeMismatch(JSON.java:112)
at org.json.JSONArray.(JSONArray.java:98)
at org.json.JSONArray.(JSONArray.java:110)
at com.getcapacitor.JSArray.(JSArray.java:16)
at com.getcapacitor.plugin.http.HttpRequestHandler.parseJSON(HttpRequestHandler.java:312)
at com.getcapacitor.plugin.http.HttpRequestHandler.readData(HttpRequestHandler.java:239)
at com.getcapacitor.plugin.http.HttpRequestHandler.buildResponse(HttpRequestHandler.java:209)
at com.getcapacitor.plugin.http.HttpRequestHandler.request(HttpRequestHandler.java:401)
at com.getcapacitor.plugin.http.Http$1.run(Http.java:83)
at java.lang.Thread.run(Thread.java:919)
Desktop (please complete the following information):
Android emulator api 29
Smartphone (please complete the following information):
Android emulator api 29
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: