[swift-users] JSON keys survey
Rimantas Liubertas
rimantas at gmail.com
Fri Jun 23 15:37:34 CDT 2017
> This has come up a few times in recent threads, and I wanted to gather
> some additional info on your real world use cases. Just reply to me, and
> any input is appreciated:
>
> 1. Does your JSON use snake_case_keys or CamelCase or other?
>
It depends on whether API is intended to be used with JavaScript clients.
JavaScript convention is camelBack so for APIs designed with primary
intent of having JavaScript clients it is common to have JSON keys using
the same.
In other cases however snake_case is preferable as it is somewhat easier to
read.
> 2. Is the key type consistent throughout the JSON?
>
Hopefully. Inconsistent APIs are painful.
> 3. If JSONEncoder/Decoder converted these, would you have any other need
> to specify custom keys?
>
Generally yes.
Best regards,
Rimantas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170623/326b2a3d/attachment.html>
More information about the swift-users
mailing list