Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add URI read and write methods to Utf8JsonReader/Writer and JsonElement #29936

Closed
layomia opened this issue Jun 18, 2019 · 1 comment
Closed
Assignees
Milestone

Comments

@layomia
Copy link
Contributor

layomia commented Jun 18, 2019

There is a strong need for URI support:

We should add the following APIs to the reader, writer, and JsonElement:

public ref partial struct Utf8JsonReader
{
    public System.Uri GetUri() { throw null; }
    public bool TryGetUri(out System.Uri value) { throw null; }
}

public sealed partial class Utf8JsonWriter : System.IAsyncDisposable, System.IDisposable
{
    public void WriteString(System.ReadOnlySpan<byte> utf8PropertyName, System.Uri value) { }
    public void WriteString(System.ReadOnlySpan<char> propertyName, System.Uri value) { }
    public void WriteString(string propertyName, System.Uri value) { }
    public void WriteString(System.Text.Json.JsonEncodedText propertyName, System.Uri value) { }
    public void WriteStringValue(System.Uri value) { }
}

public readonly partial struct JsonElement
{
    public System.Uri GetUri() { throw null; }
    public bool TryGetUri(out System.Uri value) { throw null; }
}

cc @ahsonkhan, @steveharter, @JeremyKuhne, @bartonjs

@layomia layomia self-assigned this Jun 18, 2019
@ahsonkhan ahsonkhan self-assigned this Jun 18, 2019
@layomia layomia removed their assignment Jun 19, 2019
@terrajobst
Copy link
Contributor

terrajobst commented Jun 26, 2019

We reviewed this today:

  • Purpose: people have Uri in their types that want to serialize them, which we already do.
  • We don't feel like we need to expose this in the reader/writer. It's also not in JSON.NET.
  • For now, close. This can be reopened if there is enough customer evidence that this needed.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 3.0 milestone Feb 1, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants