Skip to content

Writable Json DOM #30436

Closed
Closed

Description

@kasiabulat

AB#1224692
Adding a modifiable API in System.Text.Json to complement the readonly JsonDocumet.

Goals

  • Designing API
  • Implementation of provided methods
  • Tests of provided methods
  • Documentation for public API

Specification

https://github.com/dotnet/corefx/blob/master/src/System.Text.Json/docs/writable_json_dom_spec.md

Activity

  1. ahsonkhan commented on Sep 26, 2019

    @ahsonkhan
    Contributor

    Here's the work items left to do for this feature (in order/priority):

    cc @joperezr

  2. transferred this issue fromdotnet/corefxon Feb 1, 2020
  3. added this to the 5.0 milestone on Feb 1, 2020
  4. mrange commented on Feb 10, 2020

    @mrange

    What is the progress on this issue out interest?

  5. joperezr commented on Feb 11, 2020

    @joperezr
    Member

    @ahsonkhan seems like the checkboxes that we have above are a bit out of date right? since I believe that at least we have already done the second and third in the list but I may be wrong.

    @mrange Once Ahson confirms, the above comment will show the progress, and the milestone hasn't changed so we are still planning on shipping this on for .NET 5.0.

  6. stephentoub commented on Mar 20, 2020

    @stephentoub
    Member

    @terrajobst, my understanding is we've already checked in APIs here, but it's showing as "api-suggestion". How are we tracking APIs that have been merged but not reviewed?

  7. joperezr commented on Mar 20, 2020

    @joperezr
    Member

    @stephentoub given this feature's scope was big and needed to keep in sync with the fast developing System.Text.Json library, we did get special sign-off from the team to work and check-in directly into the master branch for iterations, and to have an API Review at the end in order to flush out any remaining issues we might still have. All that said, it is worth noting that we did have at least 2 design reviews and user studies around this API before it got checked in.

  8. stephentoub commented on Mar 20, 2020

    @stephentoub
    Member

    That's good to hear, but a) the checklist still lists "React to initial usability study feeback: dotnet/corefx#41128" as not done, b) the associated PR saying it was updating lots of surface area was closed (dotnet/corefx#41128), c) the assigned owner for this issue was someone no longer working on the project, d) part of this issue is "Investigate alternative design (making the JsonNode type hierarchy internal to JsonElement and unify the types) and conduct A/B usability study" which suggests we're not completely satisfied with the shape of things, e) the issue is listed as "api-suggestion" which doesn't jive with the fact that the APIs are now already checked-in and exposed from the refs, and probably more things I haven't listed. I simply want to make sure this doesn't fall through the cracks, which based on how the issue reads right now, I can totally see it doing.

  9. joperezr commented on Mar 23, 2020

    @joperezr
    Member

    I believe that some of the checklist status is not actually up-to-date, but you are right in the fact that this was falling through the cracks. I will sync with the Json Crew to make sure we find an owner for this and complete the work.

  10. ericstj commented on Mar 24, 2020

    @ericstj
    Member

    this was falling through the cracks.

    The work is in the roadmap for JSON, but at the moment it's not prioritized. The API was reviewed but UX studies pointed towards a change in direction. The right thing to do at the moment is to remove this API so that it doesn't become a hard take-back in later previews. We need to iterate on the design more before we release it.

    Either @jozkee or @layomia can you remove the API from the ref as well as whatever supporting source/tests we have? We can keep the source in a branch where we can further work out the design issues.

    I've removed @jozkee as the assignee as I don't think he's actively working on this yet.

  11. mrange commented on Mar 25, 2020

    @mrange

    The API was reviewed but UX studies pointed towards a change in direction.

    What does this mean? Writable DOM not of interest to developers? I am certainly able to work around it but I think more than me would find use for a writable DOM.

  12. ericstj commented on Mar 25, 2020

    @ericstj
    Member

    What does this mean? Writable DOM not of interest to developers

    It is still of interest. The UX study told us that the API we've designed so far was confusing to users. We wanted to iterate on that more before we committed to shipping it stable. Details are outlined above: #30436 (comment)

  13. modified the milestones: 5.0.0, Future on Jun 25, 2020
  14. layomia commented on Jul 21, 2020

    @layomia
    Contributor

    From @BreyerW in #39610 (comment):

    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)

  15. John0King commented on Oct 27, 2020

    @John0King

    same request here. JSON itself it a format to representation data, and data does not has to be statically structured. the important part is data, not the string. today it looks like that JsonDocument is a string reader and Span<char> in behind (that is called no allocate ), but I think this kind of optimize may only speed up some demo/benchmark program , because in reall application we frequently access and change the "data" , and access to string or other type will be allocate , and string = string is faster than string = read span to string . and I think today that things make json serialize/deserialize slow is because today .net use many Attributes , and access it we need Reflect , and Reflect is slow (and the naming strategy cause we need change the name twice).

    I wonder the performace between Newtonsoft.Json and System.Text.Json when only use JObject

  16. husains commented on Oct 30, 2020

    @husains

    Just wanted to mention that having the ability to deserialize JSON, make in-memory modifications to the DOM, and then serialize the resulting JSON (Either for persistence or for inclusion as an API response) would be super helpful as an E2E capability in the platform. Looking forward to seeing this ask get prioritized and delivered for .NET 6

  17. modified the milestones: Future, 6.0.0 on Dec 3, 2020
  18. steveharter commented on Jan 20, 2021

    @steveharter
    Contributor

    Closing as #29690 is tracking the writable DOM + support for C# "dynamic"

  19. ghost locked as resolved and limited conversation to collaborators on Feb 19, 2021
  20. ericstj commented on Jun 2, 2021

    @ericstj
    Member

    Update here to make sure that folks noticed. The JSON DOM feature shipped in preview 4 and is available to try. Please let us know how it works for your scenarios. Thanks!
    https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-4/#system-text-json-writable-dom-feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionarea-System.Text.Json

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions