json

Extracting information from a list of json Python

Extracting information from a list of json Python Question: Identifier Properties 1 [{"$id":"2","SMName":"pia.redoabs.com","Type":"sms"},{"$id":"3","Name":"_18_Lucene41_0.doc","Type":"file"}] 2 [{"$id":"2","SMName":"pred.redocad.com","Type":"sms"},{"$id":"3","Name":"_18_Nil41_0.doc","Type":"file"}] 3 [{"$id":"2","SMName":"promomaster.com","Type":"sms"},{"$id":"3","Name":"_17_Litre41_0.doc","Type":"file"}] 4 [{"$id":"2","SMName":"admaster.com","Type":"sms"},{"$id":"3","Name":"_k.pos","Type":"file"}] 5 [{"$id":"2","SMName":"plan.com.com","Type":"sms"},{"$id":"3","Name":"_3_Lucene41_0.doc","Type":"file"}] This is a dataframe with 2 columns "Identifier" & "Properties"> The "Properties" column appears as a list of json.The aim is to create 2 different columns for "sms" & "file". Tried json_normalize to create …

Total answers: 1

python sql table with paramter to json

python sql table with paramter to json Question: Good Day! I am trying to conver sql query into json with python, but getting an error when try to use sql query with a paramater: sql syntax error: incorrect syntax near "%" it works ok without setting paramater My db is hana and module is hdbcli …

Total answers: 1

Pandas JSON Normalize multiple columns in a dataframe

Pandas JSON Normalize multiple columns in a dataframe Question: So I have the following dataframe: The JSON blobs all look something like this: {"id":"dddd1", "random_number":"77777"} What I want my dataframe to look like is something like this: Basically what I need is to get a way to iterate and normalize all the JSON blob columns …

Total answers: 1

How to put a dictionary in a JSON?

How to put a dictionary in a JSON? Question: I’m working with a REST API, and I need to return a JSON with my values ​​to it. However, I need the items of the payload variable to show all the items inside the cart_item. I have this: payload = { "items": [], } I tried …

Total answers: 2

Change dates to quarters in JSON file Python

Change dates to quarters in JSON file Python Question: I’m trying to convert the dates inside a JSON file to their respective quarter and year. My JSON file is formatted below: { "lastDate": { "0": "11/22/2022", "1": "10/28/2022", "2": "10/17/2022", "7": "07/03/2022", "8": "07/03/2022", "9": "06/03/2022", "18": "05/17/2022", "19": "05/08/2022", "22": "02/03/2022", "24": "02/04/2022" } …

Total answers: 2

Use Python to get value from element in XML file

Use Python to get value from element in XML file Question: I’m writing a program in Python that looks at an XML file that I get from an API and should return a list of users’ initials to a list for later use. My XML file looks like this with about 60 users: <ArrayOfuser xmlns="WebsiteWhereDataComesFrom.com" …

Total answers: 3

How to parse a string of multiple jsons without separators in python?

How to parse a string of multiple jsons without separators in python? Question: Given a single-lined string of multiple, arbitrary nested json-files without separators, like for example: contents = r'{"payload":{"device":{"serial":213}}}{"payload":{"device":{"serial":123}}}’ How can contents be parsed into an array of dicts/jsons ? I tried df = pd.read_json(contents, lines=True) But only got a ValueError response: ValueError: Unexpected …

Total answers: 1

Is it possible to rename a json key name using its value in Python?

Is it possible to rename a json key name using its value in Python? Question: I have this nested json dictionary and I want to rename the key name ‘Keys’ with its equivalent value using Python. I wonder if this is possible? Current – ‘Keys’: [‘AWS Backup’] I want it to be – AWS Backup: …

Total answers: 1

How to update exisitng json file with Python?

How to update exisitng json file with Python? Question: I have data.json and read to data variable. f = open("data.json", "r") data = np.array(json.loads(f.read())) ouput of ‘data’ as below. [{ "symbol" : "NZDCHF", "timeframe" : [ {"tf":"H4","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"H1","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M30","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M15","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M5","x1":0,"y1":0,"x2":0,"y2":0} ] }, { "symbol" : "AUDCHF", "timeframe" : [ {"tf":"H4","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"H1","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M30","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M15","x1":0,"y1":0,"x2":0,"y2":0}, {"tf":"M5","x1":0,"y1":0,"x2":0,"y2":0} …

Total answers: 1