Netflix | Onsite | Query JSON objects
Anonymous User
4746

Let's say you have an array of similar json objects. Example object:

{
  "field1": "bar",
  "field2": 1,
  "field3": true,
  "field4": [1, 2, 3],
  "field5": {
    "nested": {
		"other": [4, 5]
	}
  }
  ...
}

Design a method to query this array. You have to design the code and the format of the query:

def search(docs, query):
  pass

Query examples:

  • Get documents where field 1 is equal to "bar"
  • Get documents where field 4 contains (or doesn't contain) 2
  • Get documents where field5.nested.other contains 4
  • Get docs where field3 is True
  • etc.
Comments (9)