core K. Li
Internet-Draft Alibaba Group
Intended status: Standards Track R. Sun
Expires: September 10, 2015 Huawei Technologies
A. Rahman
InterDigital
March 9, 2015

CBOR Equivalents of CoRE JSON Formats
draft-li-core-cbor-equivalents-00

Abstract

JSON (RFC7159) is a text-based data format which is popular for Web based data exchanges. CBOR (RFC7049) is a binary data format which has been optimized for data exchanges for the Internet of Things. For many IoT scenarios, CBOR formats will be preferred since it can decrease transmission payload sizes compared to other data formats.

This specification defines an approach for translating JSON objects, which are relevant for the CoRE WG and its related specifications, into CBOR format. Where applicable, mapping from other formats into JSON or CBOR is also described.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on September 10, 2015.

Copyright Notice

Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.


Table of Contents

1. Introduction

1.1. Objectives

The JavaScript Object Notation (JSON) [RFC7159] is a lightweight, text-based, language-independent data interchange format. JSON is popular in the Web development environment as it is particularly easy for humans to read and write.

The Concise Binary Object Representation (CBOR) [RFC7049] is a binary data format which requires extremely small code size, allows very compact message representation, and provides extensibility without the need for version negotiation. CBOR is especially well suited for IoT environments because of its efficiency.

When converting between JSON and CBOR, as usual, many small decisions have to be made. If left without guidance, it is likely that a number of slightly incompatible dialects will emerge. This specification defines a common approach for translating JSON objects into CBOR format which are relevant for the CoRE WG and its related specifications. Where applicable, mapping from other formats (e.g. CoRE Link Format) into JSON or CBOR is also described.

1.2. Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

CoAP: Constrained Application Protocol

CBOR: Concise Binary Object Representation

CoRE: Constrained RESTful Environments

IoT: Internet of Things

JSON: JavaScript Object Notation

2. Web Links in CBOR

2.1. Background

Web Linking [RFC5988] provides a way to represent links between Web resources as well as the relations expressed by them and attributes of such a link. In constrained networks, a collection of Web links can be exchanged in the CoRE link format [RFC6690] to enable resource discovery, for instance by using the CoAP protocol [RFC7252]. [I-D.ietf-core-links-json] defines a common format for representing Web links in JSON format.

2.2. Information Model

This section discusses the information model underlying the CORE Link Format payload.

An application/link-format document is a collection of web links ("link-value"), each of which is a collection of attributes ("link- param") applied to a "URI-Reference".

The URI-Reference is represented as a name/value pair with the name "href" and the URI-Reference as the value.

The link attributes are also represented as name/value pairs with attribute names and attribute values.

The information model of the CoRE Link Format can be summarized below: