Transform a String to JSONObject
<p>I am building an Android app that uses socket.IO to communicate with a server. On the socket I am receiving the following message:</p>

<pre><code>{"id":"presenterResponse","response":"accepted","sdpAnswer":"v=0\r\no=- 3689503004 3689503004 IN IP4 0.0.0.0\r\ns=Kurento Media Server\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=msid-semantic: WMS ARDAMS\r\na=group:BUNDLE audio video\r\nm=audio 1 UDP/TLS/RTP/SAVPF 111 0\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=mid:audio\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=rtpmap:111 opus/48000/2\r\na=rtpmap:0 PCMU/8000\r\na=setup:active\r\na=sendrecv\r\na=rtcp-mux\r\na=fmtp:111 minptime=10; useinbandfec=1\r\na=maxptime:60\r\na=ssrc:3140217435 cname:user2918705367@host-8692fd1\r\na=ice-ufrag:aYIP\r\na=ice-pwd:sKftuHNg7pyX0FocNO0qh/\r\na=fingerprint:sha-256 33:B4:A7:4B:89:64:D2:54:AF:6B:FE:D4:5D:EF:4E:D6:AB:6F:11:B1:E7:31:87:D6:0D:22:3F:53:83:08:B7:73\r\nm=video 1 UDP/TLS/RTP/SAVPF 100\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=mid:video\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtcp-fb:100 goog-remb\r\na=setup:active\r\na=sendrecv\r\na=rtcp-mux\r\na=ssrc:2322920152 cname:user2918705367@host-8692fd1\r\na=ice-ufrag:aYIP\r\na=ice-pwd:sKftuHNg7pyX0FocNO0qh/\r\na=fingerprint:sha-256 33:B4:A7:4B:89:64:D2:54:AF:6B:FE:D4:5D:EF:4E:D6:AB:6F:11:B1:E7:31:87:D6:0D:22:3F:53:83:08:B7:73\r\nm=application 0 DTLS/SCTP 5000\r\na=inactive\r\na=mid:data\r\na=ice-ufrag:igJW\r\na=ice-pwd:skfFXPCVLtGwABgXg9xsMO\r\na=fingerprint:sha-256 33:B4:A7:4B:89:64:D2:54:AF:6B:FE:D4:5D:EF:4E:D6:AB:6F:11:B1:E7:31:87:D6:0D:22:3F:53:83:08:B7:73\r\n"}
</code></pre>

<p>What I want to do now is to map this object on the following POJO class:</p>

<p>import org.webrtc.SessionDescription;</p>

<pre><code>public class User {

    private String id;

    private String response;

    private String name;

    private String room;

    private String email;

    private String sdpOffer;

    private SessionDescription sdpAnswer;

    private String userType;

    public User(){};

    public SessionDescription getSdpAnswer() {
        return sdpAnswer;
    }

    public void setSdpAnswer(SessionDescription sdpAnswer) {
        this.sdpAnswer = sdpAnswer;
    }

    public String getResponse() {
        return response;
    }

    public void setResponse(String response) {
        this.response = response;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getSdpOffer() {
        return sdpOffer;
    }

    public void setSdpOffer(String sdpOffer) {
        this.sdpOffer = sdpOffer;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
</code></pre>

<p>So far I have tried to transform the message in a JSONObject <code>JSONObject j = new JSONObject(message);</code> and populate my own object from the JSONObject but it didn't work. 
How can I map the string on User class?</p>

<p>EDIT:
the message comes over socket.IO from a Node.js server in this way:
In the node server I send the message by <code>send.("new message",JSON.stringfy("sdpAnswer":sdpAnswer));</code>
On the android client I read it like:</p>

<pre><code>LoginActivity.mSocket.on("new message", new Emitter.Listener() {

            @Override
            public void call(Object... args) {
                Log.i( TAG, "message back:received ");
             JSONObject j = new JSONObject(args[0]); // this throws an error
                   Object = new JSONObject(args[0].toString());
                    Log.i(TAG, "The received string is " + obj.toString()); //this throws java.lang.error can not convert from string to json object


}
)};
</code></pre>