Error Reading Object From Jsonreader
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company error reading jobject from jsonreader. current jsonreader item is not an object: null. Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs error reading jobject betternet Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, error reading jobject from jsonreader betternet just like you, helping each other. Join them; it only takes a minute: Sign up JSON.Net error reading up vote 26 down vote favorite 6 I'm trying to parse some JSON data with Json.Net. Here is my
Betternet Error
data: [ { "UIDClan": "1", "UIDKnjiga": "1", "Naslov": "Title1", "DatumZaKada": "2013-08-09 00:00:00", "DatumIstekRez": null, "Spremno": "0" }, { "UIDClan": "1", "UIDKnjiga": "2", "Naslov": "Title2", "DatumZaKada": "2013-08-08 00:00:00", "DatumIstekRez": null, "Spremno": "0" }, { "UIDClan": "1", "UIDKnjiga": "3", "Naslov": "Title3", "DatumZaKada": "2013-08-09 00:00:00", "DatumIstekRez": "2013-10-09 00:00:00", "Spremno": "1" } ] With this piece of code i want to extract UIDClan data: JObject o = JObject.Parse(s); Console.WriteLine(o["UIDClan"]); The error is Error reading JObject from JsonReader. Current betternet error windows 10 JsonReader item is not an object: StartArray. Path '', line 1, position 1. I've checked with JSONLint and it's valid. The examples that I found doesn't start with [. Am I doing something wrong? json.net share|improve this question edited Jul 13 at 21:24 mikeTheLiar 2,58672848 asked Sep 8 '13 at 20:18 Josef 75341126 add a comment| 1 Answer 1 active oldest votes up vote 58 down vote accepted You could try using a JArray. This JSON data is actually an array. JArray v = JArray.Parse(s); To get the first item. var firstItem = v[0]["UIDClan"].ToString(); You can even use linq var items = v.Where(x => x["UIDClan"].ToString() == "1").ToList(); share|improve this answer edited Sep 8 '13 at 20:41 answered Sep 8 '13 at 20:25 scartag 13.3k32442 Thanks a lot! This is it. Cheers! –Josef Sep 8 '13 at 20:56 what if my object was just a single string? JObject.parse fails for the same reason and unfortunately for me, there is no JString.parse... –ozzy432836 Mar 18 at 15:39 2 just answered my own question. JRaw.Parse seems to work with a string –ozzy432836 Mar 18 at 15:41 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a gu
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more jarray to jobject about Stack Overflow the company Business Learn more about hiring developers or posting
Betternet Vpn Error
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Newtonsoft Json Jsonreaderexception Error Reading Jobject From Jsonreader Path Line 0 Position 0
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up JSON.NET Error reading JObject up vote 4 down vote favorite I http://stackoverflow.com/questions/18688261/json-net-error-reading am sending a JSON object via AJAX and Web Api to my Server: var data = [ ["fdsfsd", "Kifdsfa", "fsdfsa", "fadsf", "fasdfsd", "fadsf", "fasdfsd"], ["2008", "-5", "11", "12", "13"], ["2009", "20", "-11", "14", "13"], ["2010", "30", "15", "-12", "readOnly"] ]; $.ajax({ url: '../webapi/Products', type: 'POST', dataType: "text", data: "="+JSON.stringify( data ), success: function (test) { alert(test); }, error: function (test) { alert("Error"); } so i am getting on server http://stackoverflow.com/questions/13823109/json-net-error-reading-jobject the value which i want to parse with JSON.NET: public void Post([FromBody]string value ) { JObject o = JObject.Parse(@value); } This throws the exception: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1. Why? The value seems to be right to me? asp.net ajax json asp.net-web-api json.net share|improve this question asked Dec 11 '12 at 15:31 daniel 3,861175097 Did you print value on the server to check if the syntax is correct? My Guess is, you are getting a json array and not a json object –HashtagMarkus Dec 11 '12 at 15:35 yes it seems to be array. So there is no way to convert this to a JObject right? How can i convert this array e.g. to a DataTable? –daniel Dec 11 '12 at 15:41 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote accepted json.stringify will create the following json string: [ ["fdsfsd", "Kifdsfa", "fsdfsa", "fadsf", "fasdfsd", "fadsf", "fasdfsd"], ["2008", "-5", "11", "12", "13"], ["2009", "20", "-11", "14", "13"], ["2010", "30", "15", "-12", "readOnly"] ] Which is a jsonArray and not a JsonObject. So on server side you'll have to read it usi
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about http://stackoverflow.com/questions/7071086/error-while-using-newtonsoft-json-to-parse-a-json-string hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. https://forums.xamarin.com/discussion/53103/why-do-json-not-work Join them; it only takes a minute: Sign up Error while using Newtonsoft.Json to parse a Json string up vote 8 down vote favorite My JSON string looks like this. Please note that it has escape characters. string json error reading = "\"{\\\"Status\\\":true,\\\"ID\\\":24501}\""; When I use the Parse method like below I run into an error stated below: JObject o = JObject.Parse(json); Error reading JObject from JsonReader. Current JsonReader item is not an object: String How do I get rid of this error or is there any other method to parse my json string and fetch the values? json parsing json.net share|improve this question edited Aug 15 '11 at 21:35 Joe 47.2k1083114 asked Aug 15 '11 at 21:34 SVI 65621126 object from jsonreader no answer of this, m facing the same prob –Mayur Jul 2 '12 at 13:00 add a comment| 5 Answers 5 active oldest votes up vote 4 down vote Remove first and last quotes: string json = "{\"Status\":true,\"ID\":24501}"; See the Json format here. share|improve this answer answered Aug 15 '11 at 21:35 MByD 98k17184213 add a comment| up vote 2 down vote It seems like your object is double encoded. Try: string json = "{\"Status\":true,\"ID\":24501}"; share|improve this answer answered Aug 15 '11 at 21:37 Joe 47.2k1083114 4 That json string is what I get from an API. How do I remove the escape characters?\ –SVI Aug 15 '11 at 21:48 2 @SVI : I'm late to the party but if anybody needs it, just replace them using something like json.Replace("\\\\", "\\") –SolarBear Sep 24 '12 at 19:23 add a comment| up vote 1 down vote You need something like this json = json.Replace(@"\", string.Empty).Trim(new char[]{'\"'}) share|improve this answer answered Jun 22 '15 at 4:16 Samuel 961213 add a comment| up vote 0 down vote in here format should be something like this: string jsonNew = @"{'Status': True,'ID': 24501 }"; share|improve this answer answered May 8 '14 at 6:13 DevT 2,212113868 add a comment| up vote 0 down vote As SolarBear says in his comment, the problem is double-escaping. To get the proper format, like this: string json = "{\"Status\":
All Products Customers Pricing Developers Support Developer Support Consulting Partners Consulting Services Contact Sales Resources Blog FAQ Partners Webinars About Xamarin Blog About Xamarin Questions Best Of... Sign In · Register Welcome Guides Recipes APIs Samples Forums Components Videos Forum › General Categories Recent Threads Activity Best Of... Unanswered Why do json not work? GuillaumeGARIDEL Guillaume GARIDELFRMember ✭ October 2015 in General Hello all, i start with give to all my excuse for my bad english, because i'm french. So now i explain my problem. My appli works two day before but on this two day i need to work on server and not on appli. So when i return on appli my application dont work . She's post me an error : Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 2. at Newtonsoft.Json.Linq.JObject.Load so i know my problem come of json.Look the code of error: public async Task Login (string user_email, string user_password) { var content = new Dictionary