I think standard notation for javascript properties is camelCase (most of frameworks in javascript use camelCase), so JSON keys must be camelCase (according to javascript object notation), also I’ve seen WIKIPEDIA and W3SCHOOLS documentation about JSON, all sample wrote in camelCase, but when see API documentation of Twitter, Facebook, Instagram and … all API key wrote in underscore separated notation.
What is standard notation of JSON?
{
"firstName" : "behrooz"
}
or
{
"first_name" : "behrooz"
}
5
Answers
JSON defines no convention for the choice of property names. There is no standard for this.
Here is a snippet on Googles intepretation on JSON naming conventions…
Choose meaningful property names.
Property names must conform to the following guidelines:
dollar sign. Reserved JavaScript keywords should be avoided (A list
of reserved JavaScript keywords can be found below).
These guidelines mirror the guidelines for naming JavaScript identifiers. This allows JavaScript clients to access properties using dot notation. (for example, result.thisIsAnInstanceVariable). Here’s an example of an object with one property:
https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format
Typically you’ll find JSON keys to be camel cased. This is of course entirely up to the developer, and many APIs use underscores. But the mainstream solution is
propertyName
.Well according to JSON API.org
It should be,
Check JSON standarts specification here:
https://www.rfc-editor.org/rfc/rfc4627
As you can see there is not standart format vor objects key.