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

Writable Json DOM #30436

Closed
kasiabulat opened this issue Jul 31, 2019 · 15 comments
Closed

Writable Json DOM #30436

kasiabulat opened this issue Jul 31, 2019 · 15 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Text.Json
Milestone

Comments

@kasiabulat
Copy link
Contributor

kasiabulat commented Jul 31, 2019

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

@ahsonkhan
Copy link
Member

ahsonkhan commented Sep 26, 2019

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

cc @joperezr

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@mrange
Copy link

mrange commented Feb 10, 2020

What is the progress on this issue out interest?

@joperezr
Copy link
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.

@stephentoub
Copy link
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?

@joperezr
Copy link
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.

@stephentoub
Copy link
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.

@joperezr
Copy link
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.

@ericstj
Copy link
Member

ericstj commented Mar 24, 2020

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.

@mrange
Copy link

mrange commented Mar 25, 2020

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.

@ericstj
Copy link
Member

ericstj commented Mar 25, 2020

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)

@layomia
Copy link
Contributor

layomia commented Jul 21, 2020

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)

@John0King
Copy link

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

@husains
Copy link

husains commented Oct 30, 2020

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

@steveharter
Copy link
Member

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

@ghost ghost locked as resolved and limited conversation to collaborators Feb 19, 2021
@ericstj
Copy link
Member

ericstj commented Jun 2, 2021

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Text.Json
Projects
None yet
Development

No branches or pull requests