Skip to Content

JSON To Table Mapping

Overview

Data in Vinyl is modeled using relational tables. Most REST APIs use JSON to communicate. In order to process the JSON data within Vinyl, a transformation must occur to map the JSON data to relational tables. This mapping occurs as follows:

  • JSON objects and their nested children objects are flattened into a single table.
  • JSON arrays create new tables.

Examples

Simple Object

JSON

{
  "name": "Thomas Magnum",
  "occupation": "Private Eye"
}

Relational Table

Table "endpoint"

name occupation
Thomas Magnum Private Eye

Nested Object

JSON

{
  "name": "Thomas Magnum",
  "occupation": "Private Eye",
  "bestCar": {
    "model": "Ferrari 308 GTS",
    "year": "1978"
  }
}

Relational Table

Table "endpoint"

name occupation bestCar/model bestCar/year
Thomas Magnum Private Eye Ferrari 308 GTS 1978

Arrays

JSON

{
  "name": "Thomas Magnum",
  "occupation": "Private Eye",
  "ferraris": [
    { "model": "308 GTS", "year": "1978" },
    { "model": "308 GTSi", "year": "1980" },
    { "model": "308 GTSi Quattrovalvole", "year": "1984" },
  ]
}

Relational Tables

Table "endpoint"

name occupation
Thomas Magnum Private Eye

Table "endpoint/ferraris"

model year
308 GTS 1978
308 GTSi 1980
308 GTSi Quattrovalvole 1984