Comments (4)
I can try out a few things on how to render json.
One thing I have already noticed, is that it is considerably harder to work with System.Text.Json, as its JValue equiviliant "JsonValue" is created as a JsonValueTrimmable which I can't really get the typeof.
But I can look around a bit, and see if I can figure it out.
from dumpify.
I have tried a few things with Generating JSON, and so far the easiest would be to consider JValue (NewtonSoft) and JsonValue (System.Text.Json) as KnownSingleValues, and then generating them using the SingleValueDescriptor. Alternatively, I can add a separate Descripter + Render-method for the Json-Values, which would hopefully make it easier to customize in the future.
For the following JSON-input, we will then get the follwowing output:
[
{
"Sample":"Basic Sample",
"Id": 1,
"Text":"StringValue"
},
{
"Sample": "Object Sample",
"Id": 2,
"Nested Object": {
"Bool": false,
"Text": "StringValue"
}
},
{
"Sample":"Array Sample",
"Id": 3,
"Array": [1,2,3]
}
]
from dumpify.
Great work @Hejle, thanks!
I want to keep the descriptors as general as possible, so creating a new type of descriptor only for Json-types should be our last resort.
A better option IMO is to create a custom renderer and register all of the Json-related types in our custom type handlers. Currently I don't like that we need to do it in CustomValueGenerator
. I would like to first work on a way to register the custom-types directly via the custom renderers, so we only have to specify types that need custom rendering in one place, which is the renderer itself.
Once that is done, it will be easier to write a single ICustomTypeRenderer
that support the json-related types.
from dumpify.
Why not render them as json instead of table? Spectre.Console already support it. Doc here
from dumpify.
Related Issues (20)
- .NET Standard HOT 5
- Problem rendering Dictionary classs which implements an Enumerator which is not castable to IEnumerable HOT 1
- Sign Dumpify
- Support for progress bar HOT 3
- Support for positioning the lable at the top of output HOT 2
- Support for generating simple string without double-quotes HOT 4
- Question: .NETStandard 2.0 support HOT 12
- Virtual Member HOT 6
- Dumping characters is not displaying properly HOT 2
- Special consideration for DirectoryInfo HOT 2
- Dump() does not print out public fields HOT 2
- DumpifySettings class? HOT 2
- Character encoding problem in PowerShell (rare & intermittent) HOT 2
- dumpify nuget manager install error: NU1108: Cycle detected. HOT 2
- Question: Is there a way to disable line wrapping? HOT 14
- Use columns for properties when dumping collections? HOT 3
- Support for HTML output? HOT 1
- Support for Markdown output? HOT 4
- Transition from MSTest to xUnit for Unit Testing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dumpify.