Skip to content

JTokenExtensionsOther

Rob edited this page Aug 4, 2026 · 2 revisions

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.CreateObjectTree(JToken, string[]) Method

Given a list of object names, return the JObject at the end of the list, and create it and its parents if required

public static QuickJSON.JObject CreateObjectTree(this QuickJSON.JToken token, params string[] names);
Parameters

token JToken
token to start with, must be an object

names System.String[]
list of object names to traverse down and create

Returns

JObject
Final JObject

Exceptions

JsonException
Exceptes if the token is not an object, or if one of the names exists but is not an object


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

Clone this wiki locally