[Open Payments] camelCase vs snake_case

Whilst writing and implementing the Open Payments stuff I have leant towards using camelCase for the resource returned from the endpoints.

Does anyone have any opinions about this? I prefer camel case but TBH I don’t want us spending much mental effort arguing the merits of either so happy to change if people have strong opinions on it.

Matt

Big +1 on camelCase. Using snake case in JSON means you have to do funny conversions all the time in your code (especially in Javascript) where the JSON can be directly parsed.

I suggest that we define the Open Payments responses to use camelCase as we can detect if the client/server supports it based on whether they use the Open Payments media type in their Accept header or not.

2 Likes

I’m also in favor for camelCase. I always wondered why the javascript SPSP server implementation is using snake_case. Do you know what the reasoning behind that was?

Snake case for JSON IIRC