Python Forum

Full Version: What's the best way to sort this data with Python?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi forum,

I work with JSON and API software Postman a lot and often times, the data that I get from a request is structured in such a way that it is unmanageable to work with without having to manually filter it which is often tedious and long. I was wondering if there was a way for me create a code which would allow me to sort data so it would be easily accessible.

The below is an example without the URL string. If I paste this into excel, it will all fall under one column which is not ideal.
I would love to have a way to sort the gross value and receipt ids through some sort of script and for it to be separated on different sheets.

Would be the icing on the cake if there was a way to also add all the gross values too.

The data comes with "" and so is difficult to filter. This is how the API request is posted and retrieved.

Whether this is possible, I'm not too sure but I thought i'd ask on here if anyone could help me out :)
{
    "count": 1,
    "page": 0,
    "pageCount": 1,
    "collection": [
        {
            "receiptId": 1964279,
            "createdAt": "2020-03-13T08:34:59",
            "receiptDate": "2020-03-13T08:23:00",
            "grossValue": 1.45,
            "receiptStatus": "PROCESSED",
            "photos": [
                {
                    "created": "2020-03-13T08:34:59",
                    "updated": "2020-03-13T08:34:59",
                    "createdByCustomer": 6604,
                    "updatedByCustomer": 6604,
                    "createdByEmployee": null,
                    "updatedByEmployee": null,
                    "id": 2363023,
                    "name": "08dcae27-56a1-4858-a9ae-4cb9348adc32.jpg",
                    "url": 
}
Thanks

Ideally i'd want to convert this as CSV output if possible
Of course anything's possible. What have you tried?
Please provide a sample URL