We’re rewarding the question askers & reputations are being recalculated! Read more.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

How can I make json data from requests into excel file?

This is my first time dealing with json data. So I'm not that familiar with the structure of json. I got some data through "we the people" e-petition sites with following code: url = "https://api....
-1
votes
0answers
25 views

How can my Python web scraper access HTML code generated dynamically?

I want to get the size information for Nike shoes from the offical website. Here is the link: https://www.nike.com/t/air-max-90-shoe-Vdv6Ll/CI5646-001 I found that the HTML code in the browser is ...
0
votes
0answers
32 views

Return shortest distance total miles and show a graph [on hold]

I have a json file for a list of deliveries and the miles attached to them, I would like to use the dijkstra algorithm that I have created and show the total miles of the shortest path and print it to ...
-2
votes
3answers
38 views

How to get dict from json one line dict

I have a json file with a dict and I want to get that dict. I tried json.load(), but there comes this error message: 'json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)' I saw ...
-1
votes
1answer
24 views

Weird JSONDecodeError

Here's my code, where AttrDict is an attributive dictionary. I also parsed my json to an online validator and it said it's ok. available_langs = AttrDict({}) # Language import for translation in os....
0
votes
3answers
34 views

Reading json in python separated by newlines

I am trying to read some json with the following format. A simple pd.read_json() returns ValueError: Trailing data. Adding lines=True returns ValueError: Expected object or value. I've tried various ...
1
vote
1answer
35 views

How to get rid of the datatype in json response from flask/mongoengine

I'm developing an application backend using flask When I return responses, some datatypes are included in it along with the value. Here is a sample code of some logic to return a document value def ...
0
votes
1answer
16 views

dumps() takes 1 positional argument but 2 were given

import json a={"name": "abc", "age": 20, "sal": 20000} with open("test.json", "w") as p1: json.dumps(a, p1) Above code is giving below error dumps() takes 1 positional argument but 2 were given ...
-1
votes
0answers
14 views

send json data to the server through socket programming in python

My task is to send some json data to a particular ip address with port number and in return i will get the json data from that ip address..for this i want to write a python script..i am completely new ...
0
votes
1answer
35 views

how to flattening nested json to dataframe pandas

how to flattening JSON to pd.dataframe like this: class_id|id |schedule_id |schedule_date |lesson_price |status` 1 | 3 | 1 | 2017-07-11 | USD 25 | ONGOING 1 | 3 | 2 ...
0
votes
1answer
23 views

Validating the json files in a folder/sub folder through shell script

find dir1 | grep .json | python -mjson.tool $1 > /dev/null I am using the above command but this doesn't take the files as inputs. What should i do to check for all the json files in a folder and ...
0
votes
2answers
37 views

Return specific item from json file and print to screen

I have a JSON file that I would like to loop through the information and show certain items that I need. When I leave some of the information out it throws a error that fields are missing. Example ...
0
votes
0answers
17 views

Iterate through JSON object returned as a list with nested dictionary?

I have very limited experience with JSON, but I have a working function that returns a JSON list with three values, the last value being a nested dictionary. I would like to manipulate the list by ...
0
votes
3answers
39 views

Issue while converting API output to Pandas Dataframe

I have API output in the below format. reponse.text '{"position": {"lat": 1.352083, "lon": 103.819836}, "mapView": {"N": 1.4784001, "E": 104.0945001, "S": 1.1496, "W": 103.594}}\n' I want to ...
0
votes
1answer
21 views

How do I insert many documents (100 millions) to a local mongodb with multiprocessing?

I successfully inserted many JSON files (only chosen keys) to a local MongoDB. However, when a collection has a little bit more than 100 million rows that need to be inserted my code seems so slow. I ...
0
votes
1answer
20 views

scrape values from nested json dicts

I have data like the example below. It has dict, which has keys that are lists. Those lists also contain dicts. I want to create a list like the desired output below, where I've scraped the "Id" ...
0
votes
0answers
35 views

Encode and Decode the string ( 'latin-1') and parse to json

I am trying to parse string into JSON, the strings are the data I scrap from news API. But I face lots of encoding errors. I try to use ftfy.fix_text, replace the symbol manually. But it is endless... ...
0
votes
0answers
10 views

how do i add json results to a mysql database with python

Thanks to a lot of peoples help here i have come alone way with my project i am now at the final stages i just need some help getting my json results i see with the code i will attach and add them to ...
0
votes
0answers
27 views

make a jsonl file look pretty in python

I have a jsonl file (that i converted from json using the jsonlines library). The jsonl file have many lines that look like : {\"id\": 0, \"text\": \"# Travelling from amsterdam to new york and back ...
0
votes
3answers
24 views

Recursive function for nested dictionary returns None however prints the expected data in function [duplicate]

I have a JSON with many nested dictionaries and list that I need to modify and when I want to find the data it returns no result. However it prints the expected values before the return. Below a ...
0
votes
1answer
23 views

Merge duplicate json elements using Python

I want to perform a de-duplication of image files I have on disc. I have a json file that describes pairs of duplicates (output from duplicate-image-finder). If i were to configure auto-delete rules, ...
-1
votes
1answer
31 views

Get data inside JSON format in Python [closed]

I am making a GET request to retrieve data while using POSTMAN to check for the response. from flask import Flask, request from flask_restful import Resource, Api from sqlalchemy import create_engine ...
5
votes
2answers
95 views

How to convert nested json structure to dataframe

I converted a JSON into DataFrame and ended up with a column 'Structure_value' having below values as list of dictionary/dictionaries: Structure_value [{'Room': 6, 'Length': 7}, {'...
0
votes
2answers
29 views

How to create json object with the data stored in variables of different datatypes

How to create a json object/csv using below variables data: out = [['core java'],['angular js']] skills = 'Java' Can someone please tell me how I can get a json object/csv as shown in expected ...
0
votes
1answer
47 views

Navigating through a JSON with multiples arrays in Python

I'm trying to go through a JSON by using python but I can't access the "mbid" node. I want to print only the first "mbid" node. Here is my function : def get_data(): newJsonx = dict() for ...
1
vote
0answers
47 views

How to read required key, values from json response and store it in json format using robot framework?

I am trying to read the required key and values from JSON Response and store it in JSON file. I have a sample simplified json format as below: ${API_Output}= { "data": { "resources": { "edges": [ { ...
0
votes
0answers
19 views

nested JSON to SQL: InterfaceError: Error binding parameter 5 - probably unsupported type

I pull and save a .json every hour from an online API and save the files on drive (1/h). I would like to append the hourly data into a SQL database updated every hour. the json I receive is a nested ...
-3
votes
0answers
39 views

Is there a easier way of making a excel spreadsheet that shows names of countries and their capitals in python?

I was assigned a hw assignment where I need to write a python program that would list the names of every country and their capital that uses both excel and word. I was told to pull the data from a ...
0
votes
1answer
31 views

delete \ in column of obejct when covert to json pandas python

i have dataframe User id | user | phone ------------------ 1 | chris | {"device": "a", "brand": "a"} 2 | nat | {"device": "a", "brand": "a"} 3 | zack | {"device": "a", "brand": "a"} then ...
-1
votes
2answers
61 views

How do I remove double quotes from whithin retreived JSON data

I'm currently using BeautifulSoup to web-scrape listings from a jobs website, and outputting the data into JSON via the site's HTML code. I fix bugs with regex as they come along, but this ...
0
votes
1answer
38 views

read large file excel with multiple worksheet to json with python

I have a large excel file and have multiple worksheets its 100 MB sheet A id | name | address 1 | joe | A 2 | gis | B 3 | leo | C work_1 id| call 1 | 10 1 | 8 2 | 1 3 | 3 work_2 id| ...
0
votes
3answers
87 views

convert content of text file to json in python

I am new bee to python I need your help/suggestion, I am trying to convert the content of text file to json using python filename is json_content.txt. Below is the content of text file hostname : ...
0
votes
1answer
33 views

cannot parse json to xml using xmltodict.unparse when converting json list

Trying to do this using xmltodict.unparse: I have this structure in json: "organisations": [ {"organisation": "org1"}, {"organisation": "org2"}, {"organisation": "org3"} ] But comes ...
0
votes
2answers
38 views

Getting json.decoder.JSONDecodeError: Expecting value: line 1 column 1

Code: def get_result(response_path): response_s3_path = re.sub(config.path_prefix,'',response_path).strip('/') print('== response_s3_path') print(response_s3_path) response_local_path = ...
0
votes
0answers
6 views

Writing CSV file with Json response using python, unable to do nested iteration. I am getting KeyError

Using python I want to write this response in csv file. I am able to iterate through the 'Category' but when I try to do a nested iteration using 'NextLevel' I get KeyError. I have this json { "...
0
votes
1answer
23 views

How can I match & modify an array of dictionaries?

I'm currently stuck trying to match & modify two dictionaries against each other. At a high level, I have an array of dictionaries of potential answer_ids to each question: [{'2194241222': 'Not ...
0
votes
0answers
11 views

Read Json Url and output to Json file

I am trying to get a json formatted url into a json file. I get error TypeError: Object of type bytes is not JSON serializable password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() uid = "...
-1
votes
0answers
11 views

how can i format the json using python

How can I format the JSON using python Actual json myData={ "Employee":{ "name":"{EmployeeName}", "age":5 } } am expecting some thing like myData.format(EmployeeName="abc") output--> { "Employee"...
0
votes
2answers
23 views

Django 2.1 : Render JSONresponse to template, byte string doesn't work with javascript

In view: response = JsonResponse(available_lessons, safe=False) In template: var available_lessons_json = {{available_lessons_json.content|safe}} In my source js file I see: var ...
0
votes
1answer
52 views

Extract Complex JSON

I would like to parse some JSON into a SQL INSERT however, due to different pieces of the data lying at different levels its making it difficult to get it all. Here is the JSON file: { "...
-1
votes
0answers
8 views

What is the best output to test a python and js code together

I've seen this in a website, they were using js and html coding. I need to know what is the best way to test the code? Is it like webframe html? Thanks in advance.
1
vote
1answer
51 views

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) KeyError: [“Data Bytes 1: ”]

I have two errors which I cannot figure out how to fix. First is: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). Second is: KeyError["Data Bytes 1: "] def ...
0
votes
3answers
43 views

How can i join 2 json file on the basis of common key

Input test.json - {"strikers": [ { "name": "Alexis Sanchez", "club": "Manchester United" }, { "name": "Robin van Persie", "club": "Feyenoord" } ] } test1.json {"strikers": [ { "name": ...
0
votes
2answers
78 views

Force a string to be interpreted as a list?

I've got a data object that was created by creating what I assume is a json object - jsonobj = {} jsonobj["recordnum"] = callpri and then pushing that onto a list, as there is more than one of them -...
-2
votes
0answers
47 views

Converting a string to JSON

I am using the Gitlab python package to import json files: l = project.files.get(file_path='path', ref='branch') str = l.decode().decode('utf-8') string_to_json = json.loads(str) However, this is ...
1
vote
2answers
52 views

Is there a way to decode json that has numbers in string format?

I have a json file in which all integers and floats are represented as strings: [{"x": "123.45", "stuff": "things"}] I've been trying to figure out if there's an easy way to read it in and decode into ...
-1
votes
0answers
48 views

Python converting JSON to SQL Insert statements

I created a piece of Python that output a JSON file which gets picked up and inserted into our tables but i thought i could speed things up by just not creating the JSON file and creating a file of ...
0
votes
2answers
23 views

How to use loops to parse contents from multiple URLs in JSON - Selenium in Python

I am trying to parse data in our organization's HR system for people's profiles. I am using Selenium in Python to do the work but I encounter some difficulties. I have the URLs list and I want to ...
1
vote
2answers
55 views

How to Read .json file in python code from google cloud storage bucket

I'm trying to read a .json file as dict() in a python code from VM instance stored in google cloud storage bucket. I tried reading json file as blob: client = storage.Client() bucket = client....
0
votes
2answers
37 views

How to select elements from a python dictionary and put it in array using

How can I select specific elements, arrays or objects from python dictionary? and turn it Into array of python dictionaries (separated by the 'drug') From this {'entities': [{'confidence': 0....