Can you try the latest push of https://github.com/apigee/iloveapis2015-jwt-jwe-jws. ?
Use version 1.0.15 of the jar
apigee-edge-callout-jwt-signed-1.0.15.jar
Update your policies to use that version.
Configure it like this for “JSON” claims.
<JavaCallout name='JavaCallout-JWT-Create'>
<DisplayName>JavaCallout-JWT-Create</DisplayName>
<Properties>
<Property name="algorithm">RS256</Property>
<Property name="pemfile">private.pem</Property>
<Property name="private-key-password">{private.pempassphrase}</Property>
<!-- standard claims to embed -->
<Property name="issuer">https://apigee.net</Property>
<Property name="expiresIn">300</Property> <!-- in seconds -->
<Property name="id"/>
<!-- Property names that begin with claim_json_ are parsed as json -->
<Property name="claim_testname">CreateJwt_WithJsonClaim</Property>
<Property name="claim_json_account">{"allocations":[4,"seven",false],"verified":true,"id":1234}</Property>
</Properties>
<ClassName>com.apigee.callout.jwtsigned.JwtCreatorCallout</ClassName>
<ResourceURL>java://apigee-edge-callout-jwt-signed-1.0.15.jar</ResourceURL>
</JavaCallout>
In short, the value of a Property with a name that starts with claim_json_ will be parsed as JSON. The pretty-printed payload of the generated JWT looks like this:
{
"iss" : "https://apigee.net",
"testname": "CreateJwt_WithJsonClaim",
"exp": 1523487108,
"iat": 1523486808,
"account": {
"allocations": [
4,
"seven",
false
],
"verified": true,
"id": 1234
},
"jti": "13c23020-7ce8-4ba2-8330-d95380a5d245"
}
You can also specify a variable there, like this:
<Property name="claim_json_thing">{variable_name_here}</Property>
If you pass something that cannot be parsed as JSON, it will throw a fault.
Let me know if this works for you.