Skip to content

Commit

Permalink
Added fallback for unparsable value in System.Text.Json NumberStringC…
Browse files Browse the repository at this point in the history
…onverter
  • Loading branch information
JKorf committed Oct 9, 2024
1 parent 71ee263 commit 168dabc
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ public class NumberStringConverter : JsonConverter<string?>
return reader.GetDecimal().ToString();
}

return reader.GetString();
try
{
return reader.GetString();
}
catch (Exception)
{
return null;
}
}

/// <inheritdoc />
Expand Down

0 comments on commit 168dabc

Please sign in to comment.