Is there a standard on JSON naming?
I see most examples using all lower case separated by underscore, aka snake_case
, but can it be used PascalCase
or camelCase
as well?
Is there a standard on JSON naming?
I see most examples using all lower case separated by underscore, aka snake_case
, but can it be used PascalCase
or camelCase
as well?
There is no SINGLE standard, but I have seen 3 styles you mention ("Pascal/Microsoft", "Java" (camelCase
) and "C" (underscores, snake_case
)) -- as well as at least one more, kebab-case
like longer-name
).
这似乎主要取决于相关服务的开发人员的背景;有c/c++背景的人(或采用类似命名的语言,包括许多脚本语言、ruby等)通常会 Select 下划线变体;和其他类似(Java与.NET).例如,前面提到的Jackson库假设Java bean命名约定(camelCase
)
更新:我对"标准"的定义是一个单一的约定.因此,虽然有人可以说"是的,有很多标准",但对我来说,有Naming Conventions
多个标准,其中没有一个是"整体"标准.其中一个可以被视为特定平台的标准,但考虑到JSON用于平台之间的互操作性,这可能有意义,也可能没有意义.