This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/ServiceStack.Text/Common
tests/ServiceStack.Text.Tests/JsonTests Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ public static string StripList(string value)
59
59
if ( string . IsNullOrEmpty ( value ) )
60
60
return null ;
61
61
62
- value = value . TrimEnd ( ) ;
62
+ value = value . Trim ( ) ;
63
63
64
64
const int startQuotePos = 1 ;
65
65
const int endQuotePos = 2 ;
@@ -69,7 +69,8 @@ public static string StripList(string value)
69
69
70
70
var pos = 0 ;
71
71
Serializer . EatWhitespace ( ret , ref pos ) ;
72
- return ret . Substring ( pos , ret . Length - pos ) ;
72
+ var val = ret . Substring ( pos , ret . Length - pos ) ;
73
+ return val ;
73
74
}
74
75
75
76
public static List < string > ParseStringList ( string value )
Original file line number Diff line number Diff line change @@ -160,5 +160,21 @@ public void Can_parse_array_with_null_objects_starting_with_null_item()
160
160
Assert . Null ( items [ 0 ] ) ;
161
161
Assert . NotNull ( items [ 1 ] ) ;
162
162
}
163
+
164
+ [ Test ]
165
+ public void Can_parse_array_with_whitespaces ( )
166
+ {
167
+ var json = "[{}, {}]" ;
168
+ var arrayObjs = JsonArrayObjects . Parse ( json ) ;
169
+ Assert . That ( arrayObjs . Count , Is . EqualTo ( 2 ) ) ;
170
+
171
+ json = " [{}, {}]" ;
172
+ arrayObjs = JsonArrayObjects . Parse ( json ) ;
173
+ Assert . That ( arrayObjs . Count , Is . EqualTo ( 2 ) ) ;
174
+
175
+ json = " [ { } , { } ] " ;
176
+ arrayObjs = JsonArrayObjects . Parse ( json ) ;
177
+ Assert . That ( arrayObjs . Count , Is . EqualTo ( 2 ) ) ;
178
+ }
163
179
}
164
180
}
You can’t perform that action at this time.
0 commit comments