Dictionary

extension Dictionary

Extensions to simplify conversion of dictionaries to formatted JSON strings.

  • Converts the dictionary to a pretty-printed JSON string.

    This computed property serializes the dictionary to JSON with indentation for improved readability.

    Declaration

    Swift

    public var prettyJSON: String { get }

    Return Value

    A pretty-printed JSON string representation, or “{}” if serialization fails