All Questions
Tagged with python-2.7 json
1,278
questions
0
votes
1
answer
97
views
python2.7 - How to decode JSON without decoding the UTF-8 inside of it?
I need a function to decode UTF-8 encoded JSON. This function should take a UTF-8 encoded JSON string and convert it to UTF-8 encoded objects. The following code works:
# helper function
def ...
1
vote
1
answer
69
views
Python json.dumps of a tuple with some UTF-8 characters, either fails or converts them. I want the encoded character retained as is
On my server, a Python script gets data from a database as a tuple. Then the script converts the tuple to a string (using json.dumps()) to be passed to the JavaScript script in the user's browser.
The ...
-1
votes
1
answer
33
views
Python search for the errors in the JSON
Premise: those dictionaries are strings. Those are JSON with a bad format. I search for the errors inside those JSON and print them.
example 1:
input
{
"ced": {
"CED_PH2&...
0
votes
2
answers
1k
views
How can I access a specific dictionary in JSON file in python?
Let's say I have a dictionary in a .json file, created from a Python dictionary and dumped into this file with json.dump(my_dict, open("file.json", "r"), indent=4):
{
"...
0
votes
1
answer
1k
views
json.loads throwing error when the JSON is valid
I have json data that you can download from here (its too long to paste here). This data is being read from a file and loaded using json.loads(str). For example:
path = open(file_path_presented).read()...
1
vote
0
answers
110
views
How to insert all rows from JSON_Object to SQL Table using Python
I am new to Python and APIs. Data is a result of API response.
I have a json_object like below.
json_object = json.dumps(data,indent=2)
which has data like below. I successfully connected to SQL ...
0
votes
0
answers
125
views
Hide empty metadata field from display in CKAN
I want fields that are empty to be hidden from the metadata displayed in the frontend. How can I achieve this?
I tried setting
'validator':if_empty 'display_property':null
But it did not work.
Please ...
0
votes
1
answer
206
views
TypeError: Object of type 'ndarray' is not JSON serializable
import json
def get_dict_feature_name(terms):
feature_name = {}
feature_name['feature'] = terms
return feature_name
def save_to_json(Data, json_filename):
with open(...
0
votes
1
answer
331
views
How to do math calculation in python stored in json
Beginner of python and would like to know How to do the below math calculation in python and return the result as part of json result. Can someone help ?
Math Calculation:
Result = 66 + (6.23 * Weight)...
0
votes
0
answers
96
views
Loading tf Keras trained model produces an error
I'm trying to load a keras model that was trained before, but I'm getting an error that I don't know what it means.
Could you please help me.
2022-08-02 15:54:42.335779: W tensorflow/stream_executor/...
1
vote
1
answer
110
views
Drift management of JSON configurations by comparing with dictionary data
I am trying to write a python code for drift management, which compares the application's configuration in JSON with the predefined dictionary of key-value pairs.
Ex: Application configuration in JSON:...
0
votes
1
answer
1k
views
Python 2.7 in Microsoft Power Automate is acting like JSON is not installed
I'm trying to run some Python code in Microsoft Power Automate Desktop. I'm aware that PAD will only run Python version 2.7 or earlier. I have tested the code in the command line and it appears to ...
2
votes
2
answers
815
views
Python - get a LIST value from field in JSON
I have a JSON file containing three fields: 2 are strings and third one is field containing a list of values.
{ "STREAM": "stream",
"BASIS_STREAM": "basis"...
0
votes
1
answer
53
views
Python list of dictionaries - access keys
I need to change name of the keys in dictionary using item.replace(" ", "_").lower()
How could I access these keys?
{
"environment": [
{
"Branch ...
0
votes
1
answer
63
views
Python code opening json file - more optimal
How could I write this piece of code more optimal, not to have repetition? So, first I'm checking if there's a .json file, if there isn't I make it. If there is, I first open it, update it with new ...