REP-003 - JSON serialization
Jump to navigation
Jump to search
This document specifies REP-003 - JSON serialization, enabling the RestAuth[n 1] protocol to serialize and deserialize data in JSON[n 2].
Introduction
Notation
The following notation standards apply to this document:
- The terms "JSON object", "JSON string" and "JSON array" reference the respective data types in the JSON specification.
RestAuth data type mappings
String
A RestAuth string should be serialized as a JSON string.
If a string occurs as a root element in the specification, it should be wrapped in a JSON array. The JSON specification only allows objects or arrays as their root element. A JSON string as root is not a problem for most JSON libraries, but some have been known to choke.
Examples:
["username"]
or:
{"username": "password"}
Dictionary
A RestAuth dictionary should be serialized as a JSON object.
Example:
{"user": "username", "properties": {"email": "user@example.com"}}
List
A RestAuth list should be serialized as a JSON array.
Example:
["username1", "username2"]
References
- ↑ Ertl, M., et al., "RestAuth", Specification
- ↑ Crockford, D., "The application/json Media Type for JavaScript Object Notation (JSON)", RFC 4627, July 2006.
Authorship information
- 2014, 2015, Mathias Ertl, mati@restauth.net