json filter python 1

json filter python

output_dict = [x for x in input_dict if x['type'] == '1']

Here is what the above code is Doing:
1. We’re iterating over the input_dict list.
2. We’re checking if the type of the current item is equal to ‘1’.
3. If it is, we’re adding it to the output_dict list.

Similar Posts