Skip to content
ConsoleMonster

API Reference

Class

ValueJson

Namespace ConsoleMonster.Values
Assembly ConsoleMonster
Modifiers static

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, Int32 depth = 4, ShapeOptions? options = null) #
Returns: String

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 System.Object? requiredposition: 0
The value.
depth System.Int32 = 4 optionalposition: 1
How many levels of records and collections to write (default 4).
options ConsoleMonster.Values.ShapeOptions? = null optionalposition: 2
Shape options, or null.

Returns

The JSON text.

public static Boolean TryReindent(String text, out String indented) #
Returns: Boolean

Re-indents a JSON object or array with two spaces per level, or returns false when the text is not valid JSON.

Parameters

text System.String requiredposition: 0
The text.
indented System.String requiredposition: 1
The indented JSON.

Returns

True when the text is JSON.