Python Forum
Struggling with Juggling JSON Data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Struggling with Juggling JSON Data
#1
I have worked through 300+ pages of Shovic & Simpson's Python for Dummies All in One but hit a snag in Book 3, Chapter 2.

The first issue is that the book first discusses converting CSV files to JSON using www.convertcsv.com/csv-to-json. This works well, but the results I get don't match the book in that the dates come through as strings like
Output:
"DateJoined": "2/3/2017"
instead of the serialized dates the book shows
Output:
"Date Joined": 37683
The next issue may be related to the first, in that the book talks about converting JSON dates (which it implies are always the serialized kind) to Python dates (with human-readable formatting) and that to do that you add this:
import xlrd
but my Python (from Anaconda3 controlled by VBS) rejects the xlrd module line:
Output:
ModuleNotFoundError: No module named 'xlrd'
which doesn't seem to matter as the JSON date from the conversion wasn't serialized to begin with.

The next issue in this chapter relates to getting JSON data from Google's Firebase Realtime Database that has these automatically added keys, "Those weird things like -LAOqOxg6kmP4jhnjQXS are all keys that the Firebase generates automatically for each item of data to guarantee uniqueness."

But, when I take JSON data that I've converted from a CVS file and load it into Firebase, I don't get automatically generated keys for each dictionary (or JSON object).

These problems recur when trying to convert "an Excel date to a JSON date" in that the dates that I have are pre-converted, as well as when "Looping through a keyed JSON file"...because the JSON file doesn't have any of the keys mentioned above.

I'd like to finish the chapter, but it seems this has become a road-block due to my lack of understanding.

Thanks for any illumination.
Reply


Messages In This Thread
Struggling with Juggling JSON Data - by SamWatt - May-07-2022, 02:25 AM
RE: Struggling with Juggling JSON Data - by SamWatt - May-07-2022, 12:29 PM
RE: Struggling with Juggling JSON Data - by SamWatt - May-08-2022, 02:59 PM
RE: Struggling with Juggling JSON Data - by SamWatt - May-09-2022, 02:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Write json data to csv Olive 6 1,540 Oct-22-2024, 06:59 AM
Last Post: Olive
  encrypt data in json file help jacksfrustration 1 2,455 Mar-28-2024, 05:16 PM
Last Post: deanhystad
  Read nested data from JSON - Getting an error marlonbown 5 2,866 Nov-23-2022, 03:51 PM
Last Post: snippsat
  Reading Data from JSON tpolim008 2 2,703 Sep-27-2022, 06:34 PM
Last Post: Larz60+
  Convert nested sample json api data into csv in python shantanu97 3 5,812 May-21-2022, 01:30 PM
Last Post: deanhystad
  json api data parsing elvis 0 1,421 Apr-21-2022, 11:59 PM
Last Post: elvis
Question I am struggling with basic json library + sql alchemy w/ mariadb-connector json ->sql BrandonKastning 0 2,368 Mar-04-2022, 09:26 PM
Last Post: BrandonKastning
  Capture json data JohnnyCoffee 0 1,847 Nov-18-2021, 03:19 PM
Last Post: JohnnyCoffee
  Serializing Python data Correctly (JSON) JgKSuperstar 4 3,333 Nov-04-2021, 07:31 PM
Last Post: JgKSuperstar
  Syntax errors: Struggling to setup enviroment and load packages AH56 5 4,044 Jun-30-2021, 01:01 PM
Last Post: AH56

Forum Jump:

User Panel Messages

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