Class
ValueJson
ConsoleMonster.Values
JSON for display, written with the shared value rules (ValueShaper): records become objects (dictionary keys of any type as text), collections arrays, a record seen again on the way down "(cycle)", values past the depth limit "…", secure strings masked and byte arrays as their size. Text that already is JSON is re-indented.
Inheritance
- object
- ValueJson
Methods
public static string Serialize(object? value, int depth = 4, ShapeOptions? options = null) #A value as indented JSON. Finite documents are written in full, without the display node/time limits; collection enumeration must terminate. Record getters retain the shared stall protection.
Parameters
- value object?
- The value.
- depth int = 4
- How many levels of records and collections to write (default 4).
- options ConsoleMonster.Values.ShapeOptions? = null
- Shape options, or null.
Returns
string The JSON text.public static bool TryReindent(string text, out string indented) #Re-indents a JSON object or array with two spaces per level, or returns false when the text is not valid JSON.
Parameters
- text string
- The text.
- indented string
- The indented JSON.
Returns
bool True when the text is JSON.