Challenge #13: Extract Data from JSON

For this challenge, we’re given some JSON that contains a list of objects of differing structures. We’re tasked with extracting the id and name of each object for further processing.

Data Source

  {"id": 54, "name": "Professor Moriarty"},
  {"id": 42, "first_name": "John", "last_name": "Watson"},
  {"error": "invalid record"},
    "id": 221,
    "name": "Sherlock Holmes",
    "photo": {
      "thumbnails": [{"id":46129037}]
  {"id": 27, "first_name": "Irene", "last_name": "Adler"}


  • In case an item has an id key, we extract it into a field. Missing ids are represented as -1.

  • In case a name key is present, we use that directly. If there are first_name and last_name keys instead, we concatenate the contents into a name field. If no name is available, we use the value "N/A" to represent that fact.

Expected Output

id name
54 Professor Moriarty
42 John Watson
-1 N/A
221 Sherlock Holmes
27 Irene Adler

Data File

Get started with extract-from-json.dfl (4.4 KB) - it contains the source data.