Class JsonExtensions
- Namespace
 - ActivityPub.Types.Internal
 
- Assembly
 - ActivityPub.Types.dll
 
internal static class JsonExtensions
  - Inheritance
 - 
      
      JsonExtensions
 
- Inherited Members
 
Methods
HasProperty(JsonElement, string)
Checks if the JsonElement contains a property with a specified name.
internal static bool HasProperty(this JsonElement element, string name)
  Parameters
elementJsonElementnamestring
Returns
ToNode(JsonElement, JsonNodeOptions?)
Converts a JsonElement to the appropriate JsonNode subtype.
internal static JsonNode? ToNode(this JsonElement element, JsonNodeOptions? options = null)
  Parameters
elementJsonElementElement to convert
optionsJsonNodeOptions?Optional options to pass to JsonNode
Returns
- JsonNode
 Node containing the same information
ToNodeOptions(JsonSerializerOptions)
Converts a JsonSerializerOptions into a JsonNodeOptions with the equivalent settings.
internal static JsonNodeOptions ToNodeOptions(this JsonSerializerOptions options)
  Parameters
optionsJsonSerializerOptions
Returns
TryGetASType(JsonElement, out string?)
Attempts to read the provided JsonElement as an ActivityStreams object and return its type. Returns false if the element does not contain an object or the object does not contain a valid type.
internal static bool TryGetASType(this JsonElement element, out string? type)
  Parameters
elementJsonElementobject to read
typestringSet to the AS type on success, or null on failure
Returns
TryGetString(JsonElement, out string?)
Attempts to read the element as a string. Returns true on success.
internal static bool TryGetString(this JsonElement element, out string? str)
  Parameters
elementJsonElementElement to convert
strstringString that was read
Returns
TryGetString(Utf8JsonReader, out string?)
Attempts to read a string from the provided Utf8JsonReader. Returns false and null if the reader is not positioned at a string or reading fails. Does NOT advance the reader!
internal static bool TryGetString(this Utf8JsonReader reader, out string? type)
  Parameters
readerUtf8JsonReaderReader, not copied because we don't move it
typestringString that was read