Skip to content

JsonElement.WriteAsValue does not support scientific notation with decimal separator #30116

@ghord

Description

@ghord

I encountered the issue where following code throws:

var test = JsonDocument.Parse("{ \"test\" : 6.5e-5 }").RootElement;

using(var stream = new MemoryStream())
{
       var writer = new Utf8JsonWriter(stream);
       //throws System.ArgumentException: 'e' is an invalid end of a number. Expected a delimiter.
       test.WriteAsValue(writer);       
}

Tested on .net core 3 preview5 and preview6.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions