Json
Description
Extension methods for serializing and deserializing JSON on string and object, with built-in custom converters and JSON attribute support.
Features
object.Json(): serialize to JSON string, optional camelCasestring.Json<T>(): deserialize JSON string to Tstring.JsonFind<T>(): extract and deserialize a specific property — supports path notationroot/child/leafJsonEncrypt: transparently encrypts/decrypts a property during serializationJsonObfuscate: transparently obfuscates/deobfuscates a property during serializationJsonCompress: transparently compresses/decompresses a property during serialization
Behavior
Built-in converters handle common edge cases — tolerant parsing of string, int, long, DateTime, DateTimeOffset, Guid, Uri and Enum. Non-serializable types (Exception, Thread, Stream etc) are silently skipped. Circular references are ignored.
JsonFind<T> searches depth-first — for List<T> automatically appends s to the type name when no path is specified.
Caveats
JsonFindthrows if a node in a specified path is not founddynamicdeserialization bypasses custom converters — dates and enums return as raw stringsJsonSerializerOptionsis not a singleton — recreated per call for thread safety
Tip
Use JsonFind<T> when consuming large third-party API responses — extract only what you need without deserializing the entire payload.