Skip to content

Conversation

@nicklasl
Copy link
Member

@nicklasl nicklasl commented Oct 1, 2025

Previously the resulting json contained the context value type which meant that while the base64 decoding worked in the Confidence app the resolve was not working properly.

JSON Format Examples - Before vs After

Before the Fix (Incorrect - Type Wrappers)

The Confidence SDK was incorrectly serializing context with type wrapper objects:

  {
    "flag": "flags/test-flag",
    "context": {
      "visitor_id": {"string": "bcd97b13-ddad-4ee8-9331-aeac06370bd9"},
      "targeting_key": {"string": "test-user-123"},
      "user": {
        "map": {
          "country": {"string": "SE"},
          "age": {"integer": 25},
          "product": {"string": "premium"},
          "fraud-score": {"double": 0.7}
        }
      }
    },
    "clientKey": "test-client-secret"
  }

Issues:

  • Values wrapped in type objects like {"string": "value"}, {"integer": 25}, {"double": 0.7}
  • Nested structures wrapped in {"map": {...}}
  • Not usable with the Resolve tester tool

After the Fix (Correct - Clean JSON)

The Confidence SDK now produces clean JSON matching the OpenFeature provider:

  {
    "flag": "flags/test-flag",
    "context": {
      "visitor_id": "bcd97b13-ddad-4ee8-9331-aeac06370bd9",
      "targeting_key": "test-user-123",
      "user": {
        "country": "SE",
        "age": 25,
        "product": "premium",
        "fraud-score": 0.7
      }
    },
    "clientKey": "test-client-secret"
  }

Copy link
Member

@fabriziodemaria fabriziodemaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the samples in the PR description, made the review easy and smooth

@nicklasl nicklasl merged commit bfab5e0 into main Oct 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants