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

Suggestion: document how to work with non-read-only equivalent of JsonDocument #24252

Closed
konrad-jamrozik opened this issue May 15, 2021 · 2 comments · Fixed by #24963
Closed
Assignees
Labels
🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-enhancement Improve the current content [org][type][category] dotnet-fundamentals/svc Pri2

Comments

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented May 15, 2021

From the article:

System.Text.Json.JsonDocument provides the ability to build a read-only Document Object Model (DOM)

Suggestion: explain what I am supposed to do if I want to have a non-read-only DOM.

Example use case: as input I have multiple objects, and json strings. I want to represent all the strings and objects as structured jsons (like JsonDocument), to compose them into one bigger json, and convert it to json string.

For example, imagine I have multiple json configuration files which I want to compose into one bigger json configuration file, where the input configuration files will be nested as json property values into the output json config file. I do not want to introduce any types to represent the constituent config files. Instead, I want to keep the composition logic generic.

Related items:

Related Stack Overflow question:
https://stackoverflow.com/questions/58694837/system-text-json-merge-two-objects


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@tdykstra
Copy link
Contributor

The Migrate from Newtonsoft article has a section about workarounds for this:

https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0#jsondocument-is-read-only

Support for writable DOM will be in .NET 6 and will be documented with the other .NET 6 new features.

@konrad-jamrozik
Copy link
Contributor Author

konrad-jamrozik commented May 17, 2021

@tdykstra thx for the info! Once available, would be nice if this article links to it. Something like "Tip! If you want to have a writable DOM, see <link to article>".

@tdykstra tdykstra added the doc-enhancement Improve the current content [org][type][category] label May 17, 2021
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label May 17, 2021
@tdykstra tdykstra self-assigned this May 17, 2021
@tdykstra tdykstra added the 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release label May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-enhancement Improve the current content [org][type][category] dotnet-fundamentals/svc Pri2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants