2dbi

Infer the schema of a dataset of JSON records

viaLeetCode

Infer the schema of a dataset of JSON records. Given a list of records, return a schema mapping each key to its inferred type (int, string, list of <type>, or a nested record of sub-schemas). Records can be arbitrarily nested.

[{"a": 1, "b": ["hello", "world"], "c": "foo"}]
// => a: int, b: list of string, c: string

[{"a": {"b": ["hello", "world"]}, "c": "foo"}]
// => a: record of { b: list of string }, c: string
Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account