its me again, this time i have on Android a Volley Exception caused by the Json I receive. I look for similar questions but a learn it could be for multiple reasons.
This is the Json i send:
{
"Branch 1":"1010901",
"2nd Item Number 1":"2 T",
"Or Ty 1":"WO",
"Order Number 1":"454678",
"Loc LE1 1":" ",
"UM 1":"PC",
"Lot Effectivity Date 1":"15\/12\/2023",
"Expired Date 1":"15\/12\/2033",
"Memo Lot 2 1":"454678",
"Memo Lot 1 1":"15\/12\/2023",
"Lot Serial Number 1":"LOTE100",
"Complete Date 1":"15\/12\/2023",
"Quantity Shipped 1":"12",
"Reason Code 1":"T01"
}
my code request, its a POST method:
JsonObjectRequest objectRequest = new JsonObjectRequest(Request.Method.POST,
Url.VALIDATOR_URL, obj, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
progressDialog.dismiss();
Log.d("JSON response -->", response.toString());
try {
if (response.getJSONObject("ansr_A").has("ErrorSync_one")){
AlertDialog.Builder builder = new AlertDialog.Builder(Principal.this);
builder.setTitle("¡ERROR!")
.setIcon(R.drawable.ic_error)
.setMessage("Record not inserted error. (A)")
.setPositiveButton("Accept", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
and this is the response i get from the request:
{"ansr_A":"ErrorSync_one"}
But at the same time ends with the message of the exception that captures:
Value ErrorSync_one at ansr_A of type java.lang.String cannot be converted to JSONObject
I even did tests on Postman and everything seems normal.
Can someone help me please? I have to mention that I use on headers Basic Auth and ContentType/JSON . I also use Oracle JDEdwards as back for my project.