Class MicroJson.JsonUtilities
Provides utility methods for working with JSON strings without full deserialization.
Assembly: MicroJson.dll
View Source
public static class MicroJson.JsonUtilities
Methods
GetRootPropertyNames(string)
Extracts all root-level property names from a JSON object string.
View Source
public static List<string> GetRootPropertyNames(string json)
Returns
System.Collections.Generic.List<System.String>: A list of root-level property names
Parameters
| Type | Name | Description |
|---|---|---|
System.String | json | The JSON string to parse |
GetPropertyValue(string, string)
Extracts a specific property value from a JSON object string without full deserialization.
View Source
public static string? GetPropertyValue(string json, string propertyName)
Returns
System.String: The JSON value as a string, or null if not found
Parameters
| Type | Name | Description |
|---|---|---|
System.String | json | The JSON string to parse |
System.String | propertyName | The name of the property to extract |
GetPropertyValues(string, params string[])
Extracts multiple property values from a JSON object string.
View Source
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
| Type | Name | Description |
|---|---|---|
System.String | json | The JSON string to parse |
System.String[] | propertyNames | The names of the properties to extract |
GetAllRootProperties(string)
Extracts all root-level properties from a JSON object string as key-value pairs.
View Source
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
| Type | Name | Description |
|---|---|---|
System.String | json | The JSON string to parse |