Alternative to json.dumps in Python

I am using below Python code in Apigee Hybrid.

json.dumps() function converts a Python object into a json string.

But to use this I need to do import json which is not supported.

token_components = {
"header": base64.urlsafe_b64encode(json.dumps(header).encode()).decode().rstrip("="),
"payload": base64.urlsafe_b64encode(json.dumps(payload).encode()).decode().rstrip("="),
}

 Is there any alternative to achieve what json.dump does without using it ?

0 1 872
1 REPLY 1

It looks like you are fiddling around with a JWT.  Why not use the DecodeJWT builtin policy? 

If you explain what you really want to do. (other than use json.dumps), I might be able to provide better advice.