Skip to content

Questions about kasiabulat writable jsondom #39610

Closed

Description

@BreyerW

I was scanning kasiabulat effort writable jsondom

And it seems almost done except it doesnt support latest features like preserve reference but thats a given considering they are very recent additions and maybe some bits are slighty incomplete

What prevented shipping it (aside from kasiabulat no longer working for Net Core team)? Or in other words was is missing because im thinking on grabbing it up and finishing

Is this link most up to date design/code? I saw several branches related to this effort and as such im not 100% sure what was accepted and what is merely an experimentation

And assuming i would pick it up how would you feel if i merged JsonBoolean, JsonNumber, JsonString and JsonNull into JsonValue backed by byte array? Byte array would be created using MemoryMarshal.CreateSpan of length=1 then AsBytes+ToArray except string where marshal would be replaced by AsSpan (creates char span). And i would either add IsNull property or rely on JsonValueKind for null values. Alternatively Unsafe.As could be used instead of marshal?

cc @ahsonkhan & @jozkee since if im not mistaken they put quite some effort on System.Text.Json

Activity

  1. 333fred commented on Jul 19, 2020

    @333fred
    Member

    I believe you meant to open this on the runtime repo. I'll transfer it over.

  2. transferred this issue fromdotnet/csharplangon Jul 19, 2020
  3. added
    untriaged
    on Jul 19, 2020
  4. BreyerW commented on Jul 19, 2020

    @BreyerW
    Author

    @333fred oh right sorry i had runtime and csharplang opened in browser side by side and didnt notice this slip up xD

  5. jozkee commented on Jul 20, 2020

    @jozkee
    Member
  6. ahsonkhan commented on Jul 20, 2020

    @ahsonkhan
    Contributor

    Here's the issue and post which captures the state of the writable dom and what work items are left:
    #30436 (comment)

    The primary blocker is making sure folks are happy with the API design and customers are successful with it. From the linked issue:

    Investigate alternative design (making the JsonNode type hierarchy internal to JsonElement and unify the types) and conduct A/B usability study

    There are benefits and drawbacks of having the JsonNode types being a public hierarchy on the side, separate from JsonElement, but it is important that the option to unify the types within JsonElement, hiding the hierarchy from the end user, is explored to understand that aspect of an alternative design, first.

    The latest code can be found in this PR, where it was removed until someone goes through the above mentioned exercise (I believe this is for post .NET 5.0): #34099

  7. BreyerW commented on Jul 20, 2020

    @BreyerW
    Author

    EDIT i scanned the diff in your link and i think i get it how you want to unify but im concerned this way is going to affect negatively current performance with JsonDocument since theres a lot of type checks and type casts. Also theres problem with JsonElement remaining struct (bigger problem imo from usability standpoint)

    The benefit of class is that you can effectively 'rip apart' serialized object property by property and the root object will still get updated when single property get updated. Eg databinding scenario where each property is isolated and updated separately. With struct im not sure if that will work nicely (maybe since they are backed by class anyway)

  8. layomia commented on Jul 21, 2020

    @layomia
    Contributor

    As @ahsonkhan mentioned, #30436 (comment) highlights what the next steps for the writable JSON DOM are, and that is the tracking issue.

    Closing this issue as a duplicate - I'll copy your comments over there and we'll be sure to consider them as we continue the effort for the feature. @BreyerW

  9. removed
    untriaged
    on Jul 21, 2020
  10. added this to the 5.0.0 milestone on Jul 21, 2020
  11. ghost locked as resolved and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions