I'm attempting to create a new JSONObject from a String however for some reason the new JSONObject is always null - and I'm unsure why.
Any suggestions are appreciated.
Source:
JSONObject messagesObj;
String mArr = intent.getStringExtra("msgArr");
try {
if (mArr != null)
messagesObj = new JSONObject(mArr);
if (messagesObj != null)
populateMessages(messagesObj);
DataManager.clientChatMarkMessagesSeen(chatId);
} catch (JSONException e) {
// DataManager.clientChatLoad(this);
e.printStackTrace();
}
Values:
String mArr = [{"message":"User has joined the chat.","type":"agent","created":"2016-12-07 17:35:09","name":"User"},{"message":"Hello World?","type":"agent","created":"2016-12-07 17:35:17","name":"User"},{"message":"User has left the chat.","type":"agent","created":"2016-12-07 17:38:40","name":"User"}]