# toJson abstract method

Map<String, String?> toJson()

Convert to map (useful for JSON serialization).

This method creates a Map representation of the locale, which is particularly useful for JSON serialization, database storage, or API communication.

Returns a Map with keys 'language', 'country', and 'variant'. Country and variant may be null if not specified.

Example:

    final locale = Locale('en', 'US', 'POSIX');
    final map = locale.toJson();
    print(map);
    // Output: {language: en, country: US, variant: POSIX}

    // Convert to JSON
    import 'dart:convert';
    final json = jsonEncode(map);
    print(json); // Output: {"language":"en","country":"US","variant":"POSIX"}

## Implementation

    Map<String, String?> toJson();