하고있던 코드가 잘 안되서 질문드립니다.
contactSend 는 클래스객체이고,
클래스객체를 String 변환 후 JSONObject 로 만들었습니다.
그 object를 JSONObjectRequest 로 서버에 데이터를 보내는데
자꾸 에러리스판스에서 에러가 나네요
에러내용은 아래와 같습니다.
com.android.volley.ParseError: org.json.JSONException: Value Fatal of type java.lang.String cannot be converted to JSONObject
아래는 코드입니다
아시는분 있으시면 답변 부탁드립니다 ㅠㅠ
Gson gson = new Gson();
String jsonString = gson.toJson(contactSend);
JSONObject jsonObject = null;
try{
jsonObject = new JSONObject(jsonString);
} catch (JSONException e){
e.printStackTrace();
}
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, URL_CONTACTS_ADD, jsonObject, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
request.setTag(_ctx);
queue.add(request);