I have some native android code which receives data back from the server which is then added to a JSONObject for later manipulation.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string responseStr = new StreamReader(response.GetResponseStream()).ReadToEnd();
JSONObject responseObj = new JSONObject(responseStr);
However, I'm moving this over to an mvvm framework so JSONObject can't be used (I'm also happier working with the much nicer JSON.NET libraries).
I've changed the JSONObject to JObject and come up with the following which compiles, but throws an exception on running (Cannot add a jtoken to a object)
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string responseStr = new StreamReader(response.GetResponseStream()).ReadToEnd();
var responseObj = new JObject(responseStr);
From what I've read, this should work (but is obviously isn't). Is there a way to store the responseStr as a JObject?