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)
5959 if ( string . IsNullOrEmpty ( value ) )
6060 return null ;
6161
62- value = value . TrimEnd ( ) ;
62+ value = value . Trim ( ) ;
6363
6464 const int startQuotePos = 1 ;
6565 const int endQuotePos = 2 ;
@@ -69,7 +69,8 @@ public static string StripList(string value)
6969
7070 var pos = 0 ;
7171 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 ;
7374 }
7475
7576 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()
160160 Assert . Null ( items [ 0 ] ) ;
161161 Assert . NotNull ( items [ 1 ] ) ;
162162 }
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+ }
163179 }
164180}
You can’t perform that action at this time.
0 commit comments