Improperly fashioned json for the question you’re making an attempt to execute
In my explicit case I bought this error as a result of I had been concatenating two completely different json information into one array of things. Then I began testing simply one of many information and forgot so as to add the additional aspect indicating the listing identify for the listing of dictionaries I used to be parsing.
I defined how lists and dictionaries are utilized in json and python right here:
Right here’s some pattern json to elucidate precisely what occurred, utilizing my earlier analogy, a listing of automobiles.
Let’s say I had concatenated two information with automobiles in it to create a listing of automobiles that appears like this:
{
automobiles:
[{
"brand": "Ford",
"model": "Mustang",
"year": "1964"
},
{
"brand": "Jeep",
"model": "Gladiator",
"year": "2022"
}]
}
In file car1.json I had this:
{
"model": "Ford",
"mannequin": "Mustang",
"12 months": "1964"
}
In file car2.json I had this:
{
"model": "Jeep",
"mannequin": "Gladiator",
"12 months": "2022"
}
I used to be utilizing bash to concatenate them and add the suitable construction in my instance above. Then I began testing only one file, however I forgot so as to add the “automobiles” aspect proven above and bought this error. The file alone didn’t have the right json construction that my code was anticipating. To repair it I had so as to add:
{
automobiles:
[{
"brand": "Ford",
"model": "Mustang",
"year": "1964"
}
]
}
Then the code in my instance within the submit referenced above labored.
Teri Radichel
Should you preferred this story please clap and observe:
Medium: Teri Radichel or E-mail Record: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests providers through LinkedIn: Teri Radichel or IANS Analysis
© 2nd Sight Lab 2022
____________________________________________
Creator:
Cybersecurity for Executives within the Age of Cloud on Amazon
Want Cloud Safety Coaching? 2nd Sight Lab Cloud Safety Coaching
Is your cloud safe? Rent 2nd Sight Lab for a penetration take a look at or safety evaluation.
Have a Cybersecurity or Cloud Safety Query? Ask Teri Radichel by scheduling a name with IANS Analysis.
Cybersecurity & Cloud Safety Assets by Teri Radichel: Cybersecurity and Cloud safety lessons, articles, white papers, displays, and podcasts