-
Notifications
You must be signed in to change notification settings - Fork 0
JSONFormatter
Quick formatter using Fluent syntax, quick and easy way to make a JSON string
public class JSONFormatter
Inheritance System.Object 🡒 JSONFormatter
Derived
↳ JSONFormatterStreamer
Constructor
public JSONFormatter();
For debugging purposes, return current text state. Use Get() to properly close and get the text
public string CurrentText { get; }
How big is the JSON string
public int Length { get; }
Start an array, either unnamed (at start or in array) or with property name when in object
public QuickJSON.JSONFormatter Array(string name=null);
name
System.String
FormatterException
Thrown if adding to an array or start with a property name, or if adding to an object without a property name
Clear the buffer
public void Clear();
Close the current array, object. Can close multiple levels if depth is greater than one
public QuickJSON.JSONFormatter Close(int depth=1);
depth
System.Int32
Close the JSON stream and return the JSON string representation
public string Get();
Format the JSON output with a LF at this point
public QuickJSON.JSONFormatter LF();
Start an object, either unnamed (at start or in array) or property name
public QuickJSON.JSONFormatter Object(string name=null);
name
System.String
FormatterException
Thrown if adding to an array or start with a property name, or if adding to an object without a property name
Internal prefix function
protected virtual void Prefix(bool named);
named
System.Boolean
is named parameter
Convert a JToken to fluent code
public static string ToFluent(QuickJSON.JToken tk, bool lf=false);
tk
JToken
Token tree
lf
System.Boolean
if to index the code with new lines
Convert a JToken to fluent code
public static void ToFluent(QuickJSON.JToken tk, System.Text.StringBuilder code, bool lf=false, string propertyname=null);
tk
JToken
Token tree
code
System.Text.StringBuilder
build into stringbuilder
lf
System.Boolean
if to index the code with new lines
propertyname
System.String
Pass the property name to this level. Null on start
Add an array element with bool value
public QuickJSON.JSONFormatter V(bool value);
value
System.Boolean
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add an array element with a double value
public QuickJSON.JSONFormatter V(double value);
value
System.Double
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add an array element with a float value
public QuickJSON.JSONFormatter V(float value);
value
System.Single
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add an array element with int value
public QuickJSON.JSONFormatter V(int value);
value
System.Int32
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add an array element with long value
public QuickJSON.JSONFormatter V(long value);
value
System.Int64
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add an array element with string data
public QuickJSON.JSONFormatter V(string data);
data
System.String
FormatterException
Thrown if adding to an object because of no property name or if first element added
Add a property called name with bool value
public QuickJSON.JSONFormatter V(string name, bool value);
name
System.String
value
System.Boolean
FormatterException
Thrown if adding to an array or start with a property name
Add a property called name with a double value
public QuickJSON.JSONFormatter V(string name, double value);
name
System.String
value
System.Double
FormatterException
Thrown if adding to an array or start with a property name
Add a property called name with a float value
public QuickJSON.JSONFormatter V(string name, float value);
name
System.String
value
System.Single
FormatterException
Thrown if adding to an array or start with a property name
Add a property called name with int value
public QuickJSON.JSONFormatter V(string name, int value);
name
System.String
value
System.Int32
FormatterException
Thrown if adding to an array with a property name or if first element added
Add a property called name with long value
public QuickJSON.JSONFormatter V(string name, long value);
name
System.String
value
System.Int64
FormatterException
Thrown if adding to an array or start with a property name
Add a property called name with string data
public QuickJSON.JSONFormatter V(string name, string data);
name
System.String
data
System.String
FormatterException
Thrown if adding to an array or start with a property name
Add a property called name with a DateTime value formatted in Zulu time
public QuickJSON.JSONFormatter V(string name, System.DateTime value);
name
System.String
value
System.DateTime
FormatterException
Thrown if adding to an array or start with a property name
Add an array element with a DateTime value formatted in Zulu time
public QuickJSON.JSONFormatter V(System.DateTime value);
value
System.DateTime
FormatterException
Thrown if adding to an object because of no property name or if first element added
Classes | |
---|---|
JSONFormatter.FormatterException | QuickJSONFormatter Error exception |