Skip to content

Move JsonSerializer to the root namespace - System.Text.Json #29639

Closed
dotnet/corefx
#38120

Description

@ahsonkhan

Motivation:
Since JsonSerializer is the more commonly used API, move it to the root namespace. This means move JsonSerializer and JsonSerializerOptions into the root namespace, System.Text.Json:

Proposed API surface:
https://github.com/dotnet/corefx/blob/510ab9e6433ff0df29e0ae080140f4f2c1b69abd/src/System.Text.Json/ref/System.Text.Json.cs#L349

namespace System.Text.Json
JsonCommentHandling
JsonDocument
JsonElement
JsonEncodedText
JsonException
JsonProperty
JsonReaderOptions
JsonReaderState
JsonTokenType
JsonValueType
JsonWriterOptions
Utf8JsonReader
Utf8JsonWriter 
+ JsonNamingPolicy
+ JsonSerializer
+ JsonSerializerOptions

System.Text.Json.Serialization
JsonAttribute 
JsonExtensionDataAttribute 
JsonIgnoreAttribute 
- JsonNamingPolicy
JsonPropertyNameAttribute 
- JsonSerializer
- JsonSerializerOptions

Questions:

  1. Rename System.Text.Json.Serialization to something to indicate "extensibility". Maybe Converters given we plan to add JsonConverter there? Custom?
  2. Should we move reader/writer to a nested namespace?

cc @steveharter

Activity

  1. rynowak commented on May 23, 2019

    @rynowak
    Contributor

    Keep the nested namespace as root.Serialization.

    P.S. This was written by @ahsonkhan (on Ryan's machine).

  2. steveharter commented on May 23, 2019

    @steveharter
    Contributor

    For the three file moves let's be sure to coordinate with other active PRs and be sure to preserve git history.

  3. paulomorgado commented on May 23, 2019

    @paulomorgado
    Contributor

    I can't help to think that this should me more in pair with XML.

    For starters, it should be System.Json and System.Json.Serialization as it is System.Xml and System.Xml.Serialization and so on.

  4. self-assigned this
    on May 23, 2019
  5. Anipik commented on May 24, 2019

    @Anipik
    Contributor

    @ahsonkhan should we move the internal types used by the JsonSerializer to System.Text.Json namespace ?

  6. ahsonkhan commented on May 24, 2019

    @ahsonkhan
    ContributorAuthor

    should we move the internal types used by the JsonSerializer to System.Text.Json namespace ?

    I would say yes, but just confirm with @steveharter.

  7. steveharter commented on May 24, 2019

    @steveharter
    Contributor

    Should we move the internal types used by the JsonSerializer to System.Text.Json namespace ?

    Sure.

    For the three file moves let's be sure to coordinate with other active PRs and be sure to preserve git history.

    Actually, I don't think we want to physically move any files in the repo. The reader\writer\document all have their own directories even though they are in the root System.Text.Json namespace.

  8. Anipik commented on May 24, 2019

    @Anipik
    Contributor

    The reader\writer\document all have their own directories even though they are in the root System.Text.Json namespace.

    All the files in reader\writer\document are in the same namespace. If we dont move the files, some of the files\classes will be in System.Text.Json and some System.Text.Json.Serialization

  9. steveharter commented on May 24, 2019

    @steveharter
    Contributor

    Per offline discussion, I agree with this concern. However since we already have a mix of physical folders and namespaces that don't align we should refactor all of this after the usability studies and when we know the namespaces are correct (if we agree it makes sense to do that at that time).

    Otherwise it just adds short-team overhead and the possibility of additional file moves.

  10. ghost closed this as completedin corefx#38120on Jun 5, 2019
  11. transferred this issue fromdotnet/corefxon Feb 1, 2020
  12. added this to the 3.0 milestone on Feb 1, 2020
  13. ghost locked as resolved and limited conversation to collaborators on Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api-approvedarea-System.Text.Jsongood first issue

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions