JTokenExtensionsOther - robbyxp1/QuickJSON GitHub Wiki

QuickJSON

QuickJSON


JTokenExtensionsOther Class

Extension class helpers for JTokens include renames, parse string, write and read from file

public static class JTokenExtensionsOther

Inheritance System.Object 🡒 JTokenExtensionsOther


Methods


JTokenExtensionsOther.JSONParse(string, ParseOptions) Method

Static parse of string. See JToken.Parse

public static QuickJSON.JToken JSONParse(this string text, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None);
Parameters

text System.String

flags ParseOptions

Returns

JToken


JTokenExtensionsOther.JSONParseArray(string, ParseOptions) Method

Static parse of string for a JArray. See JArray.Parse

public static QuickJSON.JArray JSONParseArray(this string text, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None);
Parameters

text System.String

flags ParseOptions

Returns

JArray


JTokenExtensionsOther.JSONParseObject(string, ParseOptions) Method

Static parse of string for a JObject. See JObject.Parse

public static QuickJSON.JObject JSONParseObject(this string text, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None);
Parameters

text System.String

flags ParseOptions

Returns

JObject


JTokenExtensionsOther.ReadJSONAndConvertBack(string, ParseOptions, bool) Method

Read a JSON string, convert it, then turn it back to a string (default verbose)

public static QuickJSON.JToken ReadJSONAndConvertBack(this string jsontext, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None, bool verbose=true);
Parameters

jsontext System.String

flags ParseOptions

verbose System.Boolean

Returns

JToken


JTokenExtensionsOther.ReadJSONFile(string, ParseOptions) Method

Read a file and turn it into JSON. Null if can't read file or not json

public static QuickJSON.JToken ReadJSONFile(this string filepath, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None);
Parameters

filepath System.String

flags ParseOptions

Returns

JToken


JTokenExtensionsOther.RemoveObjectFieldsKeyPrefix(JToken, string) Method

Clone object and remove all names starting with prefix

public static QuickJSON.JObject RemoveObjectFieldsKeyPrefix(this QuickJSON.JToken jo, string prefix);
Parameters

jo JToken

prefix System.String

Returns

JObject


JTokenExtensionsOther.RenameObjectFields(JToken, string, string, bool) Method

Clone a JObject and replace the fields in a JObject with different names given a pattern

public static QuickJSON.JObject RenameObjectFields(this QuickJSON.JToken jobject, string pattern, string replace, bool startswith=false);
Parameters

jobject JToken
JSON Object

pattern System.String
Property name pattern to search for. Properties with this name or starting with this pattern name are altered

replace System.String
Replace the part of the name found using pattern with this. The rest of the name is kept

startswith System.Boolean
If false, replace any part of the name which has pattern in it with replace string.
If true, only replace names which start with pattern with replace string

Returns

JObject
Return a new JObject with these new names.


JTokenExtensionsOther.RenameObjectFieldsUnderscores(JToken) Method

Clone object and remove all underscores

public static QuickJSON.JObject RenameObjectFieldsUnderscores(this QuickJSON.JToken jo);
Parameters

jo JToken

Returns

JObject


JTokenExtensionsOther.WriteJSONFile(JToken, string, bool) Method

Read a file and turn it into JSON. Null if can't read file or not json

public static bool WriteJSONFile(this QuickJSON.JToken jo, string path, bool verbose=false);
Parameters

jo JToken

path System.String

verbose System.Boolean

Returns

System.Boolean