H5P Guides

Package Definition (h5p.json)

This page describes which properties that can be used in the h5p.json file, and which are optional.

Mandatory properties

The h5p.json file includes metadata and library dependencies for H5P content packages. 

Mandatory fields should always be included in the h5p.json file. The following fields are mandatory:

title

The title of the H5P would typically be used on pages displaying it, and in system administration lists. This can be any valid string.

  "title": "My Greeting card",

mainLibrary

The main H5P library for this content. This library will be initialized with the content data from the content folder.

  "mainLibrary": "H5P.Boardgame",

language

A standard language code. We are using the ISO-639-1 to classify all supported languages. This is a two-letter code, for example 'en' for English. A list of ISO-639-1 codes can be found at Wikipedia. Set "und" for language neutral content.

  "language": "und"

preloadedDependencies

Libraries that are used by this content type and needs to be preloaded for this content type to work. The dependencies are listed as objects with machineName, majorVersion, and minorVersion.  

This field must at least contain the main library of the package.

"preloadedDependencies": [
  {
    "machineName": "H5P.Boardgame",
    "majorVersion": 1,
    "minorVersion": 1
  }
]

embedTypes

List of possible embedding methods for the H5P. Specify one or both of "div" and "iframe".

"embedTypes": ["div"]

Optional properties

The optional fields of the h5p.json file can be included, and should be included where applicable to make the library as informative as possible. The following properties are optional for the h5p.json file:

authors

The name and role of the content authors. Example:

"authors": [
  {
    "name": "fnoks",
    "role": "Author"
  },
  {
    "name": "Polly Ester",
    "role": "Originator"   
  }
],

Valid values for "role" are:

  • "Author"
  • "Editor"
  • "Licensee"
  • "Originator"

source

The source (a URL) of the licensed material.

license

A code for the content license. The following license codes are recognized:

licenseVersion

The version of the license above as a string.  Possible values for CC licenses are:

  • "1.0"
  • "2.0"
  • "2.5"
  • "3.0"
  • "4.0"

Possible values for the GNU GPL license are:

  • "v1"
  • "v2"
  • "v3"

Possible values for the PD license are:

  • "-"
  • "CCO 1.0"
  • "CC PDM"

licenseExtras

Any additional information about the license

yearFrom

If a license is valid for a certain period of time, this represents the start year (as a string).

yearTo

If a license is valid for a certain period of time, this represents the end year (as a string).

changes

The changelog. An example:

"changes": [
  {
    "date": "02-07-19 11:27:00",
    "author": "fnoks",
    "log": "Initial version"
  }
]

authorComments

Comments for the editor of the content. This text will not be published as a part of copyright info.

A complete example

{
  "title": "Fill in the blanks",
  "language": "en",
  "mainLibrary": "H5P.Blanks",
  "embedTypes": [
    "div"
  ],
  "authors": [
    {
      "name": "fnoks",
      "role": "Author"
    }
  ],
  "source": "https://example.org",
  "license": "CC BY-SA",
  "licenseVersion": "4.0",
  "licenseExtras": "Extra license information is found here",
  "yearFrom": "1950",
  "yearTo": "2050",
  "changes": [
    {
      "date": "02-07-19 11:27:00",
      "author": "fnoks",
      "log": "Initial version"
    }
  ],
  "authorComments": "Author comments",
  "preloadedDependencies": [
    {
      "machineName": "H5P.Blanks",
      "majorVersion": "1",
      "minorVersion": "0"
    }
  ]
}