Sample Python code to parse JSON needed
Budget: $30 – $250 USD
I've got some JSON that an API is returning and I can't figure out how to parse it to retrieve a specific value out of it. I've spent a lot of time trying to figure this out, but to no avail, so thought I would reach out to the experts. Here's what I need to do:
I need a snippet of Python code that will let me pass in specific values to find and retrieve an individual value in the sample JSON below. For this example, I would like to return the value from the key "az" from the date key that matches the date "2021-10-15", and for the sub key "402". The correct answer for the JSON code below should be 8.
{
"ab": "value1",
"ac": "value2",
"map1": {
"2021-10-11": {
"400": [
{
"bz": 91,
"az": 51,
"baz": "91X51"
}
]
},
"2021-10-13": {
"401": [
{
"bz": 50,
"az": 60,
"baz": "50X60"
}
]
},
"2021-10-15": {
"402": [
{
"bz": 60,
"az": 8,
"baz": "60X8"
}
]
},
"2021-10-27": {
"403": [
{
"bz": 56,
"az": 40,
"baz": "56X40"
}
]
}
}
}
I need a snippet of Python code that will let me pass in specific values to find and retrieve an individual value in the sample JSON below. For this example, I would like to return the value from the key "az" from the date key that matches the date "2021-10-15", and for the sub key "402". The correct answer for the JSON code below should be 8.
{
"ab": "value1",
"ac": "value2",
"map1": {
"2021-10-11": {
"400": [
{
"bz": 91,
"az": 51,
"baz": "91X51"
}
]
},
"2021-10-13": {
"401": [
{
"bz": 50,
"az": 60,
"baz": "50X60"
}
]
},
"2021-10-15": {
"402": [
{
"bz": 60,
"az": 8,
"baz": "60X8"
}
]
},
"2021-10-27": {
"403": [
{
"bz": 56,
"az": 40,
"baz": "56X40"
}
]
}
}
}