All posts
Engineering

Every list in a job is an array

Job data often serves lists as JSON text inside JSON. Here they are real arrays: how to filter them, read them, and survive new values.

HyperJobs Team4 min read

If you have consumed job data before, you have probably met this:

JSON
{
  "employment_type": "[\"FULL_TIME\"]",
  "education": "[\"bachelor degree\"]",
  "skills": ["typescript", "graphql", "postgresql"]
}

Three fields, all lists of tokens. One is an array, two are strings containing the text of an array. It happens whenever a list is stored as text somewhere upstream and passed through verbatim, and it bites quietly: job.employment_type === "FULL_TIME" is always false, on every full-time posting. It doesn't throw and doesn't warn; your if takes the other branch, and the bug ships.

  1. Board publishes

    a list of employment types

  2. Stored as text

    encoded once

  3. Returned verbatim

    "[\"FULL_TIME\"]"

  4. JSON.parse

    in every client, forever

How a list ends up as a string: encoded once upstream, never decoded.

Here, a list is a list

Every list field on the Job object is a real array, in codes:

JSON
{
  "employment_type": ["full_time"],
  "education": ["bachelor_degree"],
  "benefits": ["Equity", "Health, dental & vision"],
  "key_skills": [
    { "skill": "SQL", "importance": "required" },
    { "skill": "AWS", "importance": "preferred" }
  ],
  "taxonomies": ["software"]
}

job.employment_type.includes("full_time") works with no decode step, no boundary function, no parseList helper copied between projects. If you are porting a client from a source that served JSON text, delete the JSON.parse: parsing an array throws.

It really is a list

A posting can carry several employment types at once (["full_time","temporary"] is a full-time contract role), and several combinations occur in the data. The ?employment_type= filter matches a value inside the list, which is why full_time finds both ["full_time"] and ["full_time","temporary"]. And since commas mean OR, ?employment_type=contract,temporary is the union: postings carrying either.

That's why the array is the honest shape. A list flattened into one string loses exactly the thing that makes these fields useful: that a role can be two things at once.

What you send is not what you read back

FieldYou sendYou read back
employment_type?employment_type=full_time["full_time"]
education?education=bachelor_degree["bachelor_degree"]

You filter with a bare code and read back an array: the filter tests membership, not equality. You never send the encoded form.

Every closed list uses one style: codes, lower-case, words joined by _ (full_time, bachelor_degree, on_site, senior), with the display text served separately as labels by /v1/vocabulary. Send a label or a misspelling and you get a 400 with the allowed values in the hint, not zero rows, because both fields are closed vocabularies and the server knows them.

Types are frozen, values are open

The compatibility policy says changing a field's type is a breaking change, and breaking changes don't happen inside /v1. An array stays an array. The other half of the same policy is just as important:

New enum values ship at any time, and they are not breaking

New taxonomies, new source values as ATS integrations land: all backwards-compatible by policy, and they can appear without notice. So can new fields on the Job object.

A client with an exhaustive switch that throws on the default case will break on a change that is, by policy, not breaking. That's not a bug in the policy. It's a bug in the client.

Don't fail on an unknown enum value or an unrecognised field. Log it, skip it, render it as-is, anything but throw.

Read the two halves together and they're one rule seen from both ends: the types are frozen so you can trust them, and the values are open so you can't enumerate them. Parse against the type. Never assume the value set is closed.

While you're in there

The payload has a few more shapes worth a second look:

  • description is absent, not null, unless you pass ?description_format=text or html. So "description" in job is false and job.description is undefined.
  • A place's label can be null. locations is one object per place, and a place the job is findable by but does not show (a country a "Remote EMEA" posting covers) has label: null. Render the labels you get and skip the nulls; the source's own strings are in locations_raw.
  • openings is absent unless you pass ?collapse=true.

And the null rule that outranks all of them: education: null means the posting said nothing, not "no degree required". A missing classification is silence, not a negative.

Field-by-field types and nullability live in the Job object.