Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Nested JSON Processing for Job Data

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Nested JSON Processing for Job Data. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Phenom job postings can store skills at different nesting levels, including role details, screening sections, and structured skill objects. Implement a function that recursively finds every skill container and returns a normalized list of unique skill names.

Formal Specification

Given posting, a JSON-compatible Python value consisting of dictionaries, lists, strings, numbers, booleans, or None, return a list of skill-name strings.

A dictionary key is a skill container when, after lowercasing and replacing spaces or hyphens with underscores, it equals skills or required_skills. A skill container may contain strings, lists, or dictionaries. For a dictionary entry, use the first string value found under name, title, or label as the skill name. Otherwise, recursively inspect its values.

Normalize each extracted name by trimming leading and trailing whitespace and collapsing internal whitespace. Deduplicate names case-insensitively while preserving the spelling and order of their first occurrence. Ignore all strings outside skill containers. Return an empty list when no skills are present.

Constraints

  • posting contains at most 10^5 dictionaries and list elements
  • Nesting depth is at most 500
  • Skill names contain strings of at most 200 characters
  • Keys are strings and all values are JSON-compatible

Function Signature

def extract_job_skills(posting):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output