Class JsonParsers

java.lang.Object
net.thauvin.erik.frankfurter.internal.JsonParsers

public final class JsonParsers extends Object
Provides JSON parsing helpers for Frankfurter API responses.

These methods convert raw JSON strings into strongly typed model objects. They are used internally by Frankfurter.

  • Method Details

    • parseCurrencies

      @NonNull public static Currencies parseCurrencies(@NonNull String json)
      Parses a JSON object of currency entries.
      Parameters:
      json - the JSON response (must not be null)
      Returns:
      the parsed currencies (never null)
    • parseCurrency

      @NonNull public static Currency parseCurrency(@NonNull String json)
      Parses a single currency entry.
      Parameters:
      json - the JSON response (must not be null)
      Returns:
      the parsed currency (never null)
    • parseError

      @NonNull public static ErrorResponse parseError(@NonNull String json, int status)
      Parses an error response.
      Parameters:
      json - the raw JSON or fallback text (must not be null)
      status - the HTTP status code
      Returns:
      the parsed error response (never null)
    • parseProviders

      @NonNull public static Providers parseProviders(@NonNull String json)
      Parses a JSON object of provider entries.
      Parameters:
      json - the JSON response (must not be null)
      Returns:
      the parsed providers (never null)
    • parseRates

      @NonNull public static ExchangeRates parseRates(@NonNull String json)
      Parses a JSON array of rate entries.
      Parameters:
      json - the JSON response (must not be null)
      Returns:
      the parsed exchange rates (never null)
    • parseSingleRate

      @NonNull public static Rate parseSingleRate(@NonNull String json)
      Parses a single rate entry.
      Parameters:
      json - the JSON response (must not be null)
      Returns:
      the parsed rate (never null)