Skip to content
Advertisement

Tag: json

Cant decode HTTP Response to JSON (Python3)

I am running a series of API tests and this one is giving me an error. As far as I can tell response.read() converts the HTTP response into binary and then decode() converts that binary into a string but it’s an empty string. When I copy paste the binary string into Python3 (b'{“error”: {“code”: “INVALID_TOKEN”, “description”: “”}}’) and issue a

How to convert csv to complex json

How to do this stuff in python pandas? I am trying to make put request to some API and not sure how to generate request body since I have the csv file only . Request body asks for fixed set of schema Answer Dataframe has a function to_dict.

How to format json so I can parse floats and strings

I am getting the error when I try to run the following code. I know it has something to do with the formating of the json file but I am not sure how to proceed/change in order to be able to get floats from the json file my code Answer data[‘listingReducer’][‘geoCode’] is a dict so doing for location in data[‘listingReducer’][‘geoCode’]gives

Merge two json files implementing a row in a specific position

I’ve 3 json files. The first one have only one sentence (file1.json): The second one have only one sentence(file.json): And the third one is a list of dictionaries (example.json) And I want to insert the sentence of file1.json or file2.json just above “Person”: “Alex” in example.json. I say file1.json or file2.json because only one exits depending on the circumstances. I’ve

Accessing JSON Elements W/ Python

I want to access the individual data for ‘vin’, ‘make’, ‘year’, etc and export to a csv. I have tried accessing it by I get a KeyError: ‘year’ This is part of the JSON tree I am working with I am just a bit confused on the syntax as I have access data from a 2D array in this same

TypeError: ‘NoneType’ object is not subscriptable on GAE instance assigning JSON to python variable

I’m getting an error TypeError: ‘NoneType’ object is not subscriptable when assigning JSON to a python variable like this sheet_id = data[“sheetID”]. It only happens on my Google App Engine instance. I don’t get it when running my Flask app locally and sending POST requests to the app with Postman. Here’s the code snippet The strange thing is that the

Advertisement