Add samples for System.Text.Json writable DOM
dodyg opened this issue · comments
Whats your idea on this ? I mean - if we were to showcase this i.e. System.Text.Json writable dom - in ASP.NET Core - what sample idea works ?
One of the primary usage for this writable DOM is the ability to modify an existing JSON document without deserializing them into objects and then serializing it again.
For example https://gist.github.com/keeguon/2310008. How would you add "wakanda" into this list of countries?
We can make the following samples
- Find a simple node and update its value
- Find a nested object node and update one of its value
- Find a nested object node and replace it
- Append an item at the end an array.
- Insert an item an n position in an array
- Replace an item in an array.
- Find an object within an array and replace one of its value
- Replace a property of number and change it to a string value
There are probably more granular examples we can create.
This adds the sample of accessing primitives from JSON string
This adds a sample about accessing object and using JsonObject
.
This adds a sample on how to find a node based on one of its value
This is a slightly more complex node LINQ search on a string property and an array
This LINQ search try to find a node that doesn't have a particular property
This shows how to create a document using JsonObject
195178c
This shows how to create a document with JsonArray
7215c50
This shows how to update properties of a JSON document 9b10602
Delete elements in a document 809fc40
Add elements into a JSON array 968a1f1