0

I'm scraping the web and pulling html attributes out as a dictionary and want to compile all of these as ojbects into a json file.

The dictionary looks like this:

{'car':'ford',
   'mpg':45,
   'VIN':'A31GAFD'}

and I want my json file to look like (or however would be most appropriate):

{
    {'car':'ford',
   'mpg':45,
   'VIN':'A31GAFD'},

    {'car':'bmw',
   'mpg':12,
   'VIN':'B441GAFD'}
}
0

1 Answer 1

1

I think all you want, is for the outer object to be an array instead:

[
    {
        'car':'ford',
        'mpg':45,
        'VIN':'A31GAFD'
    },

    {
        'car':'bmw',
        'mpg':12,
        'VIN':'B441GAFD'
    }
]

That is [ ... ] instead of { ... }

If that's not what you're asking for, then please clarify your question.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes that is exactly what I needed, I dont know why I tried making more difficult. thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.