skip to Main Content

How to format JSON data with brackets [] – Asp.net

I have write the follow code to get the data formated as JSON {"billNumber":"0003","entityActivityId":572,"customerFullName":"التوكيلات التجارية","customerMobileNumber":"0506436506","customerPreviousBalance":0,"issueDate":"2022-08-16","expireDate":"2022-09-23","billItemList":{"name":"*","quantity":1,"unitPrice":900,"discount":0,"discountType":"FIXED","vat":"0.15"}} but I want to be as follwoing: the deferrence is the [] in the details data. {"billNumber":"0003","entityActivityId":572,"customerFullName":"التوكيلات التجارية","customerMobileNumber":"0506436506","customerPreviousBalance":0,"issueDate":"2022-08-16","expireDate":"2022-09-23","billItemList":[{"name":"*","quantity":1,"unitPrice":900,"discount":0,"discountType":"FIXED","vat":"0.15"}]} my code is : dt1 = dt.ToString("yyyy-MM-dd")…

VIEW QUESTION

Json import to postgresql with python

I'm trying to import multiple json files into my postgres Database with the following code. import json import psycopg2 con = psycopg2.connect(database="kw_du", user="postgres", password="f67dd8hzFE5",host="localhost") cur = con.cursor() with open(r"C:UsersdiegoOneDriveDesktopWorkplace220906nu_2022_09_01.json", 'r') as data_file: data = json.load(data_file) with con.cursor() as cur: cur.executemany('INSERT…

VIEW QUESTION
Back To Top
Search