Note that there are some explanatory texts on larger screens.

plurals
  1. POjson.net DeserializeObject
    primarykey
    data
    text
    <p>I have following code:</p> <pre><code>string code = client.DownloadString("http://oddsportal.com/feed/prematch/1-1-hSpbs4Cd-1-2.dat"); DataSet data = JsonConvert.DeserializeObject&lt;DataSet&gt;(code.Substring(3, code.Length - 6)); textBox1.Text += "1"; </code></pre> <p>But it stops on the second line like if there was return - it doesn't write 1 in the textbox. What am I doing wrong?</p> <p>Here it is rewritten with structure: <a href="http://pastebin.com/xZAhjU8w" rel="nofollow">http://pastebin.com/xZAhjU8w</a> Thanks.</p> <p>EDIT: A used a try-catch and its exception is:</p> <blockquote> <p>Newtonsoft.Json.JsonSerializationException: Additional text found in JSON string after finishing deserializing object. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 177 at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer.cs:line 711 at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer.cs:line 663 at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 797 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 757 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 694 at oddsreader.Form1.Form1_Load(Object sender, EventArgs e) in c:\Users\zuz\Documents\Visual Studio 2012\Projects\oddsreader\oddsreader\Form1.cs:line 692</p> </blockquote> <p>When I tried some online json validators, they returned the string was valid. What could be wrong with it?</p> <p>EDIT2: I might have been completely wrong. So I will ask a simpler quastion. How could I do a foreach of "odds" array and then foreach of its subarrays? The path to odds is: ["d"]["oddsdata"]["back"]["E-1-2-0-0-0"]["odds"]. I haven't found an example code with mode than 2 level arrays.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload