how to deserializing this json in c#

{"response":[64,{"pid":"114272714","aid":"33565378"<br> "owner_id":"5005272","created":"1214309659","text":"test"<br> "src":"http:\/\/\/u5005272\/33565378\/m_2a07b7cb.jpg"<br> "src_big":"http:\/\/\/u5005272\/33565378\/x_5769a2b7.jpg"<br> "src_small":"http:\/\/\/u5005272\/33565378\/s_beb1d458.jpg"}]}

public class UserPhotos<br> {<br> public Int32 pid { get; set; }<br> public Int32 aid { get; set; }<br> public Int32 owner_id { get; set; }<br> public Int32 created { get; set; }<br> public string text { get; set; }<br> public string src { get; set; }<br> public string src_big { get; set; }<br> public string src_small { get; set; }<br> }<br> <br / > public class vkUserPhotos<br> {<br> public List response { get; set; }<br> }<br> <br / > now I cut out the first element, and desterilize in this thing<br> <code>System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();<br> string oList = oSerializer.Deserialize(json);</code>
October 8th 19 at 03:43
6 answers
October 8th 19 at 03:45
October 8th 19 at 03:47
Why sterilizati line? Celeritate in fact implies the transfer of objects to a string.
sorry, Vice versa. - garry_Romaguera commented on October 8th 19 at 03:50
October 8th 19 at 03:49
Hmm, no luck googling? "json c#" gives good results.
The fact of the matter is that Google.
and as with the example json c# did not grow together,
a proposed option as it should fall with an error that can not 1 element to convert my type, ie Int32 to UserPhotos - garry_Romaguera commented on October 8th 19 at 03:52
October 8th 19 at 03:51
Used several times, and, in General, seems good :)
October 8th 19 at 03:53
Here is a primitive json decoder (even two), carefully bydlokod but well kommentirovannyi, wrote not to carry a heavy 'right' projects json (plus not require new versions .net Will work almost since 1.1, including mono), requires zapilivanija error-handling syntax, etc. (read todo: in comentary).

The first method SimpleJSON::pairsParseJSON(string) — returns a single-level Dictionaryeach record — the elements-the leaves in the tree in the json, the key compound name elements separated by a dot (the arrays are named using '[index]'), for example:

will give an array:
"test[0].a" => "1"
"test[0].b" => "asd"
"test[1]" => "123"
p.s. this method is very convenient when working with complex json structures without arrays

The second method SimpleJSON::treeParseJSON(string) — returns the classic multi-level dictionarywhere as object can be either a string or a number, or another dictionary.
October 8th 19 at 03:55
I think should approach the design of objects here - garry_Romaguera commented on October 8th 19 at 03:58

Find more questions by tags VKontakteJSONC