Python Forum
Json fields not being retrieved
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Json fields not being retrieved
#3
Lines 5-7 are indented improperly.

As the outer json object is a mapping, that loads into python as a dict. When you run list() on it, that returns only the keys of that dict (and there's only one key).

The way you parse the JSON depends on the actual data. The dict you are interested in is inside a list, inside another dict.

    content = json.load(f)['environment-sensor']
Reply


Messages In This Thread
Json fields not being retrieved - by mrcurious2020 - Sep-14-2020, 12:16 AM
RE: Json fields not being retrieved - by scidam - Sep-14-2020, 12:34 AM
RE: Json fields not being retrieved - by bowlofred - Sep-14-2020, 01:15 AM
RE: Json fields not being retrieved - by bowlofred - Sep-14-2020, 06:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sequential number for rows retrieved and storing the Primary UKey to the line number GYKR 2 1,351 Aug-22-2023, 10:14 AM
Last Post: GYKR
  Compare fields from two csv files georgebijum 3 2,262 Apr-25-2022, 11:16 PM
Last Post: Pedroski55
  how to filter two fields in json using python python_student 4 5,165 Mar-15-2021, 05:58 PM
Last Post: python_student
  Mapping Fields zak308 0 2,971 Jan-09-2018, 10:02 PM
Last Post: zak308

Forum Jump:

User Panel Messages

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