What is JSON Anyway?

Importing and exporting your data with JSON

What is JSON Anyway?

JSON (JavaScript Object Notation) is an open standard file format and data interchange format that uses human-readable text to store and transmit data.

It is widely used and can be viewed and edited in any simple text editor. The futuristic donut image you see above is the JSON logo.

In basic terms, JSON represents your data as a series of properties and values, with each object enclosed in curly braces { } and lists of objects enclosed in square braces [ ].

Ampoule can import and export your data in JSON format. When exporting, you can either save to a file or copy the resulting text to be pasted elsewhere. If you view the output in a text editor, you will see this structure, with a list of objects representing your boxes. Each box has a drugs property, which is a list of the items it contains. All of the customisable properties from the Ampoule user interface are represented.

If you are new to this, there are a few things you might find peculiar:

  • Most text is contained inside "quotation marks", unless it has a special meaning, like true or false.

  • Every box and item has an identifier. This is globally unique and is used by Ampoule to distinguish items that might otherwise be similar, and to determine if an item has been imported before. You can see this identifier at the bottom of the editing screen in Ampoule.

  • The creation date is a number, representing the number of seconds since 1 January 2001 UTC. This is an Apple standard, which is related to Unix Time; a global standard widely used in computing for representing time.

  • The colour of items can be represented in two ways; either by a colourName property, which is one of the preset colours in Ampoule, or (if that property is empty), a colour made from the red, green and blue components in colorValues.

Example of Ampoule JSON export

The text below represents the JSON data for single box named Medical Kit, containing one item: Amoxicillin.

    "name": "Medical Kit",
    "information": "General medical kit.",
    "icon": "plus-square",
    "colorValues": {
        "blue": 0.8,
        "alpha": 1,
        "red": 0.6,
        "green": 0.3
    "colorName": "systemPurple",
    "latitude": 0,
    "longitude": 0,
    "locationName": "Belfast",
    "identifier": "23A7D877-0D3E-4F39-8F5B-8DF2D2A64A7E",
    "creationDate": 730762589.935077,
    "drugs": [
        "name": "Amoxicillin",
        "strength": 50,
        "strengthUnits": "mg/ml",
        "type": "Suspension",
        "batch": "DEF456",
        "icon": "prescription-bottle-alt",
        "colorValues": {
          "alpha": 1,
          "green": 0.3,
          "red": 0.6,
          "blue": 0.8
        "colorName": "systemPurple",
        "quantity": 1,
        "expiry": {
          "day": 30,
          "month": 6,
          "year": 2026
        "isControlled": false,
        "unitVolume": 100,
        "unitVolumeUnits": "ml",
        "tagList": [
            "name": "Antibiotic",
            "color": "systemTeal"
        "notes": "No notes."
        "sendNotifications": true,
        "gtin": "",
        "manufacturer": "",
        "identifier": "DC43C27C-FE41-4DAF-A1F0-4BCB363E6335",
        "creationDate": 731458400.26271    

Ampoule will only be able to import JSON from a file if it is formatted in this way (though not all properties need to be included).