CES JSON deserialization

I have this JSON line:

{"natalia1891": {"idUser": 1435105, "nickname": "natalia1891", "sefNick": "natalia1891", "status": 1, "photo": "HTTP: \ / \ / 213,215. 107,125 \ / fotky \ / 143 \ / 51 \ /s_1435105.jpg v = 3 "," gender? ": 2," isFriend ": 1},

"pepina888": {"idUser": 3338870, "nickname": "pepina888", "sefNick": "pepina888", "status": 1, "photo": "HTTP: \ / \ / 213.215.107.127 \ / fotky \ / 333 \ / 88 \ /s_3338870.jpg v = 9 "," gender? ": 2," isFriend ": 1}}

I would like to deserialize this JSON in the dictionary of the Friend object. Any tips?

may be:

class Friend{

public string Name{get;set;}

public string IdUser{get;set;}

public string SefNick{get;set;}

public bool Status{get;set;}

public string Url{get;set;}

public int Sex{get;set;}

public bool isFriend{get;set;}
}
+3
4
+4
+4

You can use the JsonDataContractSerializerclass in the .Net framework.

+1
source
Friend[] friends = new JavaScriptSerializer().Deserialize<Friend[]>(myString);

JavaScriptSerializer is located in System.Web.Script.Serialization.

0
source

Source: https://habr.com/ru/post/1772663/


All Articles