FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-data-engineer/08-Python-File-Handling/06-json.py at main · gkdevops/python-data-engineer · GitHub
gkdevops
/
python-data-engineer
Public
Notifications
You must be signed in to change notification settings
Fork
56
Star
44
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-data-engineer
/
08-Python-File-Handling
/
06-json.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
14 lines (10 loc) · 457 Bytes
Breadcrumbs
python-data-engineer
/
08-Python-File-Handling
/
06-json.py
Copy path
File metadata and controls
14 lines (10 loc) · 457 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
json
# Load data from the JSON file
with
open
(
'data.json'
,
'r'
)
as
file
:
data
=
json
.
load
(
file
)
# Filter only Data Engineers from the employees list
data_engineers
=
[
emp
for
emp
in
data
[
'employees'
]
if
emp
[
'role'
]
==
'Data Engineer'
]
# Save filtered data to a new JSON file
with
open
(
'data_engineers.json'
,
'w'
)
as
file
:
json
.
dump
({
"data_engineers"
:
data_engineers
},
file
,
indent
=
2
)
print
(
"Filtered data written to data_engineers.json."
)
Back
|
FazBrowse Home
|
New Git URL