![]() |
|
[C#] Valid JSON (jsonlint) couldn't be Deserialize - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Valid JSON (jsonlint) couldn't be Deserialize (/showthread.php?tid=6102173) |
Valid JSON (jsonlint) couldn't be Deserialize - HardStoN - Aug 12, 2020 So im trying to Deserialize json string which is valid (checked by jsonlint) but somehow this code: Code dynamic data = JsonConvert.DeserializeObject<dynamic>(txtRes.Text);Code data.skuModuleQuote:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: ''string' does not contain a definition for 'skuModule'' plus i used Code JsonConvert.ToString(txtRes.Text);the json string is shown by a rich text box and it is: https://pastebin.com/VzM01szD RE: Valid JSON (jsonlint) couldn't be Deserialize - HFDone - Aug 12, 2020 which library you using try data["skuModule"] RE: Valid JSON (jsonlint) couldn't be Deserialize - HardStoN - Aug 12, 2020 this is what im getting Code Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'The best overloaded method match for 'string.this[int]' has some invalid arguments'and im using using Newtonsoft.Json; (Aug 12, 2020 10:32 AM)HFDone Wrote: which library you using Answer to you RE: Valid JSON (jsonlint) couldn't be Deserialize - HFDone - Aug 12, 2020 try this data[0].skuModule 0 is the json array you want check doc https://www.newtonsoft.com/json RE: Valid JSON (jsonlint) couldn't be Deserialize - HardStoN - Aug 12, 2020 (Aug 12, 2020 11:28 AM)HFDone Wrote: try this data[0].skuModule Getting this error Code Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: ''char' does not contain a definition for 'skuModule''god dammit maybe there is something wrong with my json string although the JSONLint says its ok Quick update guys apparently my json was fucked.... it had , at the end and a missing { at the start but never mind boys thanks for the help RE: Valid JSON (jsonlint) couldn't be Deserialize - Majin Goten - Aug 15, 2020 So, has this been resolved? RE: Valid JSON (jsonlint) couldn't be Deserialize - HardStoN - Aug 15, 2020 (Aug 15, 2020 02:25 AM)MajinĀ Goten Wrote: So, has this been resolved? It is :) |