You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Questions about kasiabulat writable jsondom #39610
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
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
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)
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
Activity
333fred commentedon Jul 19, 2020
I believe you meant to open this on the runtime repo. I'll transfer it over.
BreyerW commentedon Jul 19, 2020
@333fred oh right sorry i had runtime and csharplang opened in browser side by side and didnt notice this slip up xD
jozkee commentedon Jul 20, 2020
@layomia
ahsonkhan commentedon Jul 20, 2020
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:
There are benefits and drawbacks of having the
JsonNodetypes being a public hierarchy on the side, separate fromJsonElement, but it is important that the option to unify the types withinJsonElement, 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
BreyerW commentedon Jul 20, 2020
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
JsonDocumentsince theres a lot of type checks and type casts. Also theres problem withJsonElementremainingstruct(bigger problem imo from usability standpoint)The benefit of
classis 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. Withstructim not sure if that will work nicely (maybe since they are backed by class anyway)layomia commentedon Jul 21, 2020
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