|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (2)
View Page HistoryFudge fields are added to a JSON object using either the name or ordinal (written as a base-10 signed integer) as the JSON field name. An implementation should allow the user to select which of the two to use by preference when converting to/from a Fudge message. If the Fudge field has neither name nor ordinal it will be named in JSON as the empty string. When converting a JSON object back to a Fudge message, the empty string will be treated as an anonymous field.
The JSON specification states that field names should be unique whereas Fudge encoding explicitly allows duplicate field names. An application designer should therefore avoid the use of duplicate names in Fudge messages that are intended for use with JSON. A Fudge/JSON implementation may convert repeated fields to a single JSON field with an array containing the original values, preserving the ordering. A JSON array that does not correspond to one of the primitive type Fudge arrays may be converted to repeated fields in the Fudge message. An empty JSON array results in no Fudge fields.
In case of fudge message with duplicate field names, the fudge message will be encoded with additional metadata. In such case the resulting json will be two element array rather than object. The first element of the array will be mentioned metadata and the second one will be the fudge message itself.
All encodings are implicit, using the following approach (for more details please refer to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt?number=4627] which describes JSON literal values in more detail):
