json

Converting string to a json in Python

Converting string to a json in Python Question: Im trying to convert the below string to json object using json.loads. "Error":"Execution failed on sql ‘SELECT * FROM tablename’: (‘HYT00’, ‘[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Query timeout expired (0) (SQLExecDirectW)’)" Im getting the below error. JSONDecodeError: Extra data: line 1 column 8 (char 7) How …

Total answers: 1

How to convert JSON data into JSON?

How to convert JSON data into JSON? Question: I have got an a JSON lines file: {"sample": [" Какие советы помогут вам составить успешный бизнес-план?", "n1. Изучите свой целевой рынок: поймите, кому вы продаете, насколько велика конкуренция и текущие тенденции.n2. Определите свою бизнес-модель и стратегии: решите, какие продукты и услуги вы будете предлагать и как …

Total answers: 1

Converting python dictionary value into nested keys

Converting python dictionary value into nested keys Question: I have the following dictionary: {‘expert_interests’: "[‘Machine learning’, ‘deep learning’]"} As you can see the the value of the key "expert_interests" is the String "[‘Machine learning’, ‘deep learning’]". I want to convert this string value into a nested dictionary such that the dictionary looks like this: {‘expert_interests’: …

Total answers: 2

How to parse nested JSON and load the data into a table / dataframe

How to parse nested JSON and load the data into a table / dataframe Question: I am confused how to use the json library methods and df methods. I have a json and I am trying to read it as follows: with open(json_path) as f: json_dict = json.load(f) dfs.append(pd.DataFrame([json_dict])) df = pd.concat(dfs, ignore_index=True, sort=False) display(df) …

Total answers: 1

Convert stringified json objects to json

Convert stringified json objects to json Question: I’m using MariaDB, and unfortunately, json objects are returned as strings. I want to convert these stringified json objects back to json, but the problem is – I only want to do so if they are actually json objects, and ignore all fields that are, for example, just …

Total answers: 2

Django – Can't fetch Json data in javascript

Django – Can't fetch Json data in javascript Question: Hello I am pretty new to Django and Javascript I want to build a simple application where users can write posts and see a list of all posts in reverse chronologial order on the index page. (The index page is rendered fine.) I created some Posts …

Total answers: 1

Generate SQLAlchemy models from Pydantic models

Generate SQLAlchemy models from Pydantic models Question: So I have this large JSON dataset with a huge number of properties (as well as nested objects). I have used datamodel-code-generator to build pydantic models. The JSON data has been imported into pydantic models (with nested models). Now I need to push them into the database. How …

Total answers: 1

Slice and extract specific values from JSON output

Slice and extract specific values from JSON output Question: I am querying a REST API and I need to select 2 fields from the adapter output below, the query will include multiple incident numbers. I basically need a list of Incident Numbers and Descriptions from the output below. Code to get the data: headers = …

Total answers: 2

Select specific values from JSON output

Select specific values from JSON output Question: I am querying a REST API and I need to select 2 fields from the adapter output below. I basically need to make variables from OUT_Detailed Description and OUT_Vendor Ticket Number: Code: headers = {‘content-type’: ‘application/json’, ‘Authentication-Token’: authToken} response = requests.post(‘http://dev.startschools.local:2031/baocdp/rest/process/:ITSM_Interface:IncidentManagement:QueryIncident/execute’, headers=headers, data=json.dumps(get_query_inc_json())) print(response.text) json_format = json.loads(response) Description …

Total answers: 2

How to normalize a list from a json file using python?

How to normalize a list from a json file using python? Question: I have a sample file like this sample.json { "school":[ { "testId":123, "testName":"test1", "Teachers":[ { "Tid":111, "Tname":"aaa" }, { "Tid":222, "Tname":"bbb" }, { "Tid":333, "Tname":"ccc" }, { "Tid":444, "Tname":"ddd" } ], "location":"India" } ] } i need to normalize the Teachers list from …

Total answers: 1