Class JsonParsers

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

@NullMarked 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

      public static Currencies parseCurrencies(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

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

      public static ErrorResponse parseError(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

      public static Providers parseProviders(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

      public static ExchangeRates parseRates(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

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