Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

Can't process json data



11:30 pm on Nov 13, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

I'm trying to parse a simple JSON string
[{"url":"http://loyalty.bosselman.com/Home/tabid/57/Default.aspx","position":"0","roles":"All Users;Administrators;"}]

You can find it here


When I run this code

var baseUrl = "http://loyalty.bosselman.com/DesktopModules/MyServices/API/Welcome/GetMenu?key";

WebClient client = new WebClient();
var data = client.DownloadString(baseUrl);

var obj = JsonConvert.DeserializeObject(data);

JObject job = JObject.Parse(obj.ToString());

foreach (JProperty prop in job.Properties())
I get this error

Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.

If I inspect my obj element it looks like this

"[{\"url\":\"http://loyalty.bosselman.com/Home/tabid/57/Default.aspx\",\"position\":\"0\",\"roles\":\"All Users;Administrators;\"}]"

I'm not sure why the \" are getting in there and obj.replace("\\", ""); does not remove them. What am I doing wrong?


4:33 pm on Nov 15, 2013 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

When you are inspecting the string the \" are seeing are the escaped ". The slash are not actually in the string.

Featured Threads

Hot Threads This Week

Hot Threads This Month