airbnb/lottie-android · error · IllegalArgumentException

Cannot convert json to point. Next token is {}

Error message

Cannot convert json to point. Next token is {}

What it means

PointFParser.parse() reads a PointF from the JSON stream, handling BEGIN_ARRAY, BEGIN_OBJECT, and NUMBER tokens. If the next token is none of these (e.g., STRING, BOOLEAN, NULL), it throws IllegalArgumentException. This is the higher-level entry point that delegates to JsonUtils.jsonToPoint() for array/object cases and handles bare-number pairs inline.

Source

Thrown at lottie/src/main/java/com/airbnb/lottie/parser/PointFParser.java:32

  @Override
  public PointF parse(JsonReader reader, float scale) throws IOException {
    JsonReader.Token token = reader.peek();
    if (token == JsonReader.Token.BEGIN_ARRAY) {
      return JsonUtils.jsonToPoint(reader, scale);
    } else if (token == JsonReader.Token.BEGIN_OBJECT) {
      return JsonUtils.jsonToPoint(reader, scale);
    } else if (token == JsonReader.Token.NUMBER) {
      // This is the case where the static value for a property is an array of numbers.
      // We begin the array to see if we have an array of keyframes but it's just an array
      // of static numbers instead.
      PointF point = new PointF((float) reader.nextDouble() * scale, (float) reader.nextDouble() * scale);
      while (reader.hasNext()) {
        reader.skipValue();
      }
      return point;
    } else {
      throw new IllegalArgumentException("Cannot convert json to point. Next token is " + token);
    }
  }
}

View on GitHub (pinned to 05ea92e903)

Solutions

  1. Validate the animation JSON with LottieFiles validator.
  2. Use the exception's path information to locate the malformed PointF field and fix its structure to [x, y], {"x":..,"y":..}, or bare x y.
  3. Re-export the animation from its source (After Effects / LottieFiles).
Defensive patterns

Strategy: validation

Try / catch

LottieTask<LottieComposition> task = LottieCompositionFactory.fromAsset(context, name);
task.addListener(result -> { /* success */ })
     .addFailureListener(e -> { /* malformed JSON */ });

Prevention

When it happens

Trigger: A position/anchor/vertex field in the Lottie JSON begins with an unexpected token that is not an array, object, or number. Functionally the same class of error as errors [23] and [24] but reached through the PointFParser dispatch path.

Common situations: Corrupted Lottie JSON; non-standard export tool producing unexpected token types for coordinate fields; truncation causing the reader to land on a wrong token.

Related errors


AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14). Data as JSON: /api/errors/82ad8ff20176a4b3. Report an issue: GitHub.