skip to Main Content

Can't extract data from the JSON file

I don't understand why I can't print out the data from "label". After what I've looked up this should do it: import json json_str = '{mechanisms": {"label": "Mechanismen", "type": "MechSections"}}' data = json.loads(json_str) print(data['mechanisms'][0]['label']) Instead of giving me the content…

VIEW QUESTION

Javascript – Combing two JSONs into one

I'm looping through and object and getting the data-attributes. After that I'm parsing it as a JSON. Object.entries(buyProductData).forEach(entry => { const [key, value] = entry; if(typeof value === 'object') { const data = JSON.parse(value.getAttribute('data-tracking-payload')); console.log(data); } }); console.log(data) returns two…

VIEW QUESTION
Back To Top
Search