Skip to main content

Class MicroJson.JsonUtilities

Provides utility methods for working with JSON strings without full deserialization.

Assembly: MicroJson.dll​
View Source​
Declaration
public static class MicroJson.JsonUtilities

Methods​

GetRootPropertyNames(string)​

Extracts all root-level property names from a JSON object string.

View Source​
Declaration
public static List<string> GetRootPropertyNames(string json)
Returns​

System.Collections.Generic.List<System.String>: A list of root-level property names

Parameters​
TypeNameDescription
System.StringjsonThe JSON string to parse

GetPropertyValue(string, string)​

Extracts a specific property value from a JSON object string without full deserialization.

View Source​
Declaration
public static string? GetPropertyValue(string json, string propertyName)
Returns​

System.String: The JSON value as a string, or null if not found

Parameters​
TypeNameDescription
System.StringjsonThe JSON string to parse
System.StringpropertyNameThe name of the property to extract

GetPropertyValues(string, params string[])​

Extracts multiple property values from a JSON object string.

View Source​
Declaration
public static Dictionary<string, string> GetPropertyValues(string json, params string[] propertyNames)
Returns​

System.Collections.Generic.Dictionary<System.String,System.String>: A dictionary containing the property names and their JSON values

Parameters​
TypeNameDescription
System.StringjsonThe JSON string to parse
System.String[]propertyNamesThe names of the properties to extract

GetAllRootProperties(string)​

Extracts all root-level properties from a JSON object string as key-value pairs.

View Source​
Declaration
public static Dictionary<string, string> GetAllRootProperties(string json)
Returns​

System.Collections.Generic.Dictionary<System.String,System.String>: A dictionary containing all root-level properties and their JSON values

Parameters​
TypeNameDescription
System.StringjsonThe JSON string to parse