JWTClaimsSet.Builder.claim does not preserve JSONObjects in arrays

Issue #327 invalid
Karllyts Kfk created an issue

Hello,

if i have the following code,

JSONArray array=new JSONArray();
JSONObject entry=new JSONObject("{entry1:1}");
array.put(entry);
String claims=new JWTClaimSet.Builder().claim("key",array).build().toString()

the resulting claims do not contain the object "{entry1:1}"

I’ve found no documentation on this specific behaviour and since I have used only JSON entities as indicated in the doc; it seems like a bug to me

Comments (4)

  1. Karllyts Kfk reporter

    Hello,

    Thanks for your answer. I’m aware that in my example I can use JSONObject.put(key,value) for the same expected result. But I’m given a JWTClaimsSet.Builder, the other party expecting that I can add my data with the method claim(key,value). Are limitations expected for this method? Where can I find them?

  2. Connect2id OSS

    Well, you can always use a JWSObject with Payload that is your own serialised JSON object.

    SignedJWT inherits from JWSObject.

  3. Log in to comment