-
Notifications
You must be signed in to change notification settings - Fork 0
JTokenExtensionsOther
Extension class helpers for JTokens include renames, parse string, write and read from file
public static class JTokenExtensionsOtherInheritance System.Object 🡒 JTokenExtensionsOther
Static parse of string. See JToken.Parse
public static QuickJSON.JToken JSONParse(this string text, QuickJSON.JToken.ParseOptions flags=QuickJSON.JToken.ParseOptions.None);
text System.String
flags ParseOptions
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);
text System.String
flags ParseOptions
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);
text System.String
flags ParseOptions
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);
jsontext System.String
flags ParseOptions
verbose System.Boolean
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);
filepath System.String
flags ParseOptions
Clone object and remove all names starting with prefix
public static QuickJSON.JObject RemoveObjectFieldsKeyPrefix(this QuickJSON.JToken jo, string prefix);
jo JToken
prefix System.String
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);
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
JObject
Return a new JObject with these new names.
Clone object and remove all underscores
public static QuickJSON.JObject RenameObjectFieldsUnderscores(this QuickJSON.JToken jo);
jo JToken
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);
jo JToken
path System.String
verbose System.Boolean