JsonExtensions..::..JsonPrettify Method (String, Formatting)
Formats a JSON string with the specified indentation.
Namespace:
AdvantageCMS.Core.Common.ExtensionAssembly: AdvantageCMS.Core (in AdvantageCMS.Core.dll)
Syntax
Parameters
- json
- Type: String
The raw JSON string to format.
- formatting
- Type: Formatting
The formatting style to apply. Defaults to Indented()()()().
Return Value
The formatted JSON string.Examples
Pretty-print a compact JSON string:
C#
string compact = "{\"name\":\"Agent1\",\"enabled\":true}"; string pretty = JsonExtensions.JsonPrettify(compact); // Returns: // { // "name": "Agent1", // "enabled": true // }
Minify an indented JSON string:
C#
string minified = JsonExtensions.JsonPrettify(pretty, Formatting.None); // Returns: {"name":"Agent1","enabled":true}

