Skip to content

Snake Case vs Camel Case keys #5

Answered by ElMassimo
jonathanmdavies asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Jonathan!

Not your fault, types_from_serializers incorrectly assumes you will convert the keys to camel case in the client side.

types_from_serializers should add a setting to allow transforming keys instead of assuming this out of the box.

Happy to take a pull request in types_from_serializers to add a camelize_keys config option, which is off by default.


If you are using JS, it will be more idiomatic to convert keys to camel case when receiving the JSON.

If you are using Inertia, you can do that by converting the JSON object for props, which is what I'm using in all apps.

Unfortunately Inertia does not provide a way to intercept visits (inertiajs/inertia#1052 seems to have been reve…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants