@@ -69,5 +69,58 @@ public void Can_parse_empty_array_in_dto_with_tab()
6969 var oPretty = prettyJson . FromJson < NamesTest > ( ) ;
7070 Assert . That ( oPretty . Names . Count , Is . EqualTo ( 0 ) ) ;
7171 }
72+
73+ public class CustomAuth
74+ {
75+ public string City { get ; set ; }
76+ public int Country { get ; set ; }
77+ public string FirstName { get ; set ; }
78+ public string LastName { get ; set ; }
79+ public string ScreenName { get ; set ; }
80+ public long Uid { get ; set ; }
81+ }
82+
83+ public class CustomAuthResponse
84+ {
85+ public List < CustomAuth > Response { get ; set ; }
86+ }
87+
88+ [ Test ]
89+ public void Can_parse_custom_AuthResponse ( )
90+ {
91+ var json = @"{
92+ ""response"" : [
93+ { ""city"" : 56,
94+ ""country"" : 1,
95+ ""first_name"" : ""Rouslan"",
96+ ""last_name"" : ""Grabar"",
97+ ""screen_name"" : ""iamruss2"",
98+ ""uid"" : 180423804
99+ }
100+ ]
101+ }" ;
102+
103+ var dto = JsonObject . Parse ( json )
104+ . ArrayObjects ( "response" ) [ 0 ] . ConvertTo ( x =>
105+ new CustomAuth
106+ {
107+ City = x [ "city" ] ,
108+ Country = x . Get < int > ( "country" ) ,
109+ FirstName = x [ "first_name" ] ,
110+ LastName = x [ "last_name" ] ,
111+ ScreenName = x [ "screen_name" ] ,
112+ Uid = x . Get < long > ( "uid" ) ,
113+ } ) ;
114+
115+ dto . PrintDump ( ) ;
116+
117+ using ( JsConfig . With (
118+ emitLowercaseUnderscoreNames : true ,
119+ propertyConvention : PropertyConvention . Lenient ) )
120+ {
121+ var response = json . FromJson < CustomAuthResponse > ( ) ;
122+ response . PrintDump ( ) ;
123+ }
124+ }
72125 }
73126}
0 commit comments