Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing JSON
#3
Hi @Pedroski55
Thank you for your reply.

JSON I specified as the format when I set up the CLI so it pushes the data out as a string.

CLI setup advisory here says:
"json – The output is formatted as a JSON string"

In the boto3 manual it points to me needing to use this to isolate x1 from my previous JSON string as a printed output

['device_data'][0]['x1']
Given that it will be string and your advice I used LOAD without the S:

data = json.load(response)
Then tried to print it using that boto3 guidance

print(data ['device_data'][0]['x1'])
But it returns an error saying: AttributeError: 'dict' object has no attribute 'read'

Thanks again
Reply


Messages In This Thread
Parsing JSON - by pyStund - Jul-30-2022, 09:38 PM
RE: Parsing JSON - by Pedroski55 - Jul-30-2022, 10:36 PM
RE: Parsing JSON - by pyStund - Jul-31-2022, 09:46 AM
RE: Parsing JSON - by ibreeden - Jul-31-2022, 11:13 AM
RE: Parsing JSON - by pyStund - Jul-31-2022, 02:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Parsing large JSON josvink66 5 859 Jan-10-2024, 05:46 PM
Last Post: snippsat
  Json Parsing sshree43 5 2,023 May-04-2022, 09:21 PM
Last Post: snippsat
  json api data parsing elvis 0 1,007 Apr-21-2022, 11:59 PM
Last Post: elvis
  string indices must be integers when parsing Json ilknurg 3 6,904 Mar-10-2022, 11:02 AM
Last Post: DeaD_EyE
  Help Parsing JSON kfwydfo1x 5 4,851 Jan-26-2021, 10:42 AM
Last Post: DeaD_EyE
  Parsing JSON with backslashes bazcurtis 3 9,600 Feb-08-2020, 01:13 PM
Last Post: bazcurtis
  JSON parsing (nested) fakka 0 3,171 Nov-25-2019, 09:25 PM
Last Post: fakka
  Parsing json - dictionary with in dictionary krish216 6 3,883 Jul-30-2019, 10:01 PM
Last Post: cvsae
  JSON Parsing PythonLearner007 3 2,660 Jan-31-2019, 10:47 AM
Last Post: gontajones

Forum Jump:

User Panel Messages

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