Use of ujson #1189
-
Can powertools maintainers use ujson for encoding and decoding dicts, as it may be helpful in performance improvements. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can swap out which json library you want to use, for the event, the dict was parsed before the lambda has been invoked. There are examples of bring in your own serializer: https://awslabs.github.io/aws-lambda-powertools-python/latest/core/logger/#bring-your-own-json-serializer |
Beta Was this translation helpful? Give feedback.
-
@HAK-CODE the reason we don't use If we are not providing you a mechanism to do that for a given feature, please don't hesitate to create a feature request. |
Beta Was this translation helpful? Give feedback.
@HAK-CODE the reason we don't use
ujson
by default is thatujson
it's not a fully compatible drop-in replacement. This could potentially break customers use cases we can't foresee. Instead, we prefer providing a mechanism to bring your own JSON serializer - for example, orjson as it's even faster thanujson
.If we are not providing you a mechanism to do that for a given feature, please don't hesitate to create a feature request.