Guides and Sample Code

Developer

Apple News Format Reference

On This Page

About Apple News Format

Apple News Format is the custom JavaScript Object Notation (JSON) document format that lets you create signature content for News. Beautiful typography, rich photo galleries, videos, and fun animations bring your articles to life. You can author once, and News optimizes your content for iPhone, iPad, and iPod touch — your readers will have a great experience no matter which device they’re using.

This document provides the information you need to use Apple News Format to create your articles.

image: ../Art/article.png

JSON Overview

JavaScript Object Notation (JSON) is a standard data format that is easy for computers to parse, but also fairly easy for humans to read. When working with JSON, remember these key characteristics:

  • An object is a set of name-value pairs. Each object begins with a left brace { and ends with a right brace }.

  • Name-value pairs within objects are specified in the form "name": "value". Quotation marks are required for string values, but not for integers or Booleans (true or false). This document notes the data type of each component.

  • Name-value pairs are separated by commas. But note that the last name-value pair in an object, before the closing brace, does not have a comma after it.

  • Objects are also separated by commas, but the last object in the document does not have a comma after it.

In the following example, the first and second values are strings, while the third and fourth are numbers (integers) and thus don't need quotation marks around them.

  1. {
  2. "property-name1": "value1",
  3. "property-name2": "value2"
  4. },
  5. {
  6. "property-name3": 3,
  7. "property-name4": 4
  8. }

The Apple News Format Example Articles will help you get familiar with JSON. You may also want to visit JSON.org.

Document Objects

An Apple News Format document, which represents a rendered article in the News app, consists of several types of objects:

  • Components that contain content, such as text or a photo

  • Metadata (a single object that provides various information about the article, such as the canonical URL and an excerpt or summary)

  • Components that define the structure or organization of the article, such as a section

  • Styling and layout definitions that are applied to other objects

  • Animations and behavior definitions that are applied to components

The following snippet shows an array of three typical objects in Apple News Format:

  1. "components": [ { "role": "title", "text": "A Very Basic Article", "textStyle": "title" }, { "role": "body", "text": "This Apple News Format article has only one paragraph of text." }, { "role": "photo", "URL": "http://www.example.com/image.jpg" } ]

This document provides detailed information about all available objects. You may also want to review the example articles as you start assembling your own documents.

Supported Character Sets

Apple News Format supports both ASCII and Unicode character sets. Characters may be included directly or referenced by their Unicode value. For example, the following examples will depict the same thing, “Lorem ipsum,” surrounded by typographer’s quotes.

  • "text": "“Lorem ipsum”"

  • "text": "\u201cLorem ipsum\u201d"

Additional Resources

In addition to this reference, the following will help you through the steps of creating your channel and getting the most out of Apple News Format.