Python Forum
What's the best way to sort this data with Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's the best way to sort this data with Python?
#1
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
Reply
#2
Of course anything's possible. What have you tried?
Reply
#3
Please provide a sample URL
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo a.sort() == b.sort() all the time 3lnyn0 1 2,030 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  How to sort values descending from a row in a dataframe using python sankarachari 1 2,026 Aug-16-2021, 08:55 AM
Last Post: jamesaarr
  Sort data from JSON file Dummy_in_programming 2 3,329 Jan-04-2021, 06:17 PM
Last Post: deanhystad
  python sort date beginner2020 13 9,771 Nov-06-2020, 03:30 PM
Last Post: beginner2020
  How to print counter without bracket in python and sort data. phob0s 1 3,627 Jul-25-2019, 05:33 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020