File tree Expand file tree Collapse file tree
StyleCop.Analyzers/StyleCop.Analyzers/LightJson/Serialization Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,6 +358,15 @@ private JsonObject ReadObject(JsonObject jsonObject)
358358 this . scanner . SkipWhitespace ( ) ;
359359
360360 var next = this . scanner . Read ( ) ;
361+ if ( next == ',' )
362+ {
363+ // Allow trailing commas in objects
364+ this . scanner . SkipWhitespace ( ) ;
365+ if ( this . scanner . Peek ( ) == '}' )
366+ {
367+ next = this . scanner . Read ( ) ;
368+ }
369+ }
361370
362371 if ( next == '}' )
363372 {
@@ -407,6 +416,15 @@ private JsonArray ReadArray(JsonArray jsonArray)
407416 this . scanner . SkipWhitespace ( ) ;
408417
409418 var next = this . scanner . Read ( ) ;
419+ if ( next == ',' )
420+ {
421+ // Allow trailing commas in arrays
422+ this . scanner . SkipWhitespace ( ) ;
423+ if ( this . scanner . Peek ( ) == ']' )
424+ {
425+ next = this . scanner . Read ( ) ;
426+ }
427+ }
410428
411429 if ( next == ']' )
412430 {
You can’t perform that action at this time.
0 commit comments