Questions tagged [csvtojson]

101 questions
0
votes
0 answers

How to Remove the Unicode Signature from while converting a file from CSV to JSON?

So, I tried converting a file from Kaggle which was in CSV to JSON. Which made a new JSON file, but the first field of each object had the \ufeff Unicode signature. Below mentioned is the code I used to convert the file. import csv import json…
0
votes
0 answers

Zod error not clear after CSV conversion to JSON

This is the code, the object passed has been converted to JSON from a csv sample file using csvtojson. Its failing for string check on the first line. Any clue as to why its saying it received "undefined" when clearly its a string? `import { z }…
0
votes
0 answers

Reading CSV with header=false causes the missing first line in the output

Reading CSV file with no headers, however the output is missing the first line which is not header in the CSV file. trying to convert csv to json but upon following below steps its working in online data weave editor but not in…
0
votes
1 answer

converting csv to json with specifc conditions

I want to dump the values of csv to json with specific conditions, here is code I have written: import json import csv csv_file = open("student_data.csv",'r') csv_reader = csv.DictReader(csv_file, None) #creating loop for row in csv_reader: …
0
votes
1 answer

Transform CSV into an Array of Objects

I have a CSV file like this one below, I must take some different values from it, but I'm struggling in transform this CSV into an array of Objects "+++++++++ 1.2 LifeTime Cost and Emissions +++++++++","" "…
0
votes
0 answers

Python post products with variants from csv to shopify api

i have the following problem. I want to import products to Shopify using the API. The body of the request should look like this: { "product": { "id": "100", "title": "Burton Custom Freestyle 151", "body_html": "Good…
atom_29
  • 11
  • 2
0
votes
1 answer

How do I extract single record from a large CSV using csvtojson

I'm trying to read only the first record of a large CSV using csvtojson I've to use this library, as it will be used later to extract all the records, and I need consistency in data format between the 2 fetches. My current code looks like…
Gaurav
  • 347
  • 4
  • 12
0
votes
2 answers

How to separate a column into two different keys/values - csvtojson NodeJS

I have a csv and need to convert it to json using nodejs, but parsing many things in the process to match the required fields where i need to upload the data, like hashing some info or changing the header names. The problem I'm having is that I need…
Tico
  • 1
  • 2
0
votes
2 answers

Prevent Python CSV to JSON for loop iteration from overwriting previous entry

I have a pretty basic Python For statement that I'm using to try to remap a CSV file into geoJSON format. My script looks like this: def make_json(csvFilePath, jsonFilePath): # create a dictionary data = { "type":…
thefreeline
  • 621
  • 1
  • 12
  • 26
0
votes
0 answers

CSV-File has string for every line. How can I transform it to use it for VS Code?

I am trying to import a csv-File and make a dictionary out of it. The problem is that every line is in a string. For example like this: ""First Name", "Last Name", "Date of Birth"" ""Alex", "Turner", "08.09.1978"" ""Max", "Parker",…
maxmyh
  • 3
  • 3
0
votes
0 answers

How to keep other columns when using panda groupby and lambda function?

Trying to convert a csv to json, and group objects by ID, there are multiple items need to be grouped into a nested objects, for example a company can be under multiple categories or sub categories, Longitude and Latitude should be grouped into…
Aymen Yaseen
  • 421
  • 5
  • 8
0
votes
1 answer

how to create a JSON object from a TSV file containing key/value pairs with jq

I a have a short TSV stream that outputs key/value pairs and I would like to create a JSON object out of it, with jq. For now I have this code, which generates a stack of JSON objects: printf '%s\t%s\n' key1 val1 key2 val2 | jq -R 'rtrimstr("\n") |…
Fravadona
  • 13,917
  • 1
  • 23
  • 35
0
votes
1 answer

Convert from CSV to Nested JSON with array in Python

I'm trying to convert from csv to complex nested json. Below is how my CSV looks like Sample csv title,section_id,content,expected "Test case1",1234,"Test step1","Expected Result1" "Test case1",1234,"Test step2","Expected Result2" "Test…
0
votes
0 answers

How to parse CSV into JSON while 'Amount' column containing commas

//Convert CSV file to JSON var csv = new List(); var lines = csvResponseData.Split('\n'); foreach (string line in lines) csv.Add(line.Split(',')); var properties =…
Liza
  • 33
  • 5
0
votes
1 answer

PHP convert CSV to JSON multi level

I have a CSV data looks like this : ps.csv id|firstName|lastName|address|extId|extName 001|Kapil|Parames|address01|AA01|AA 002|David|Vuitton|address01|AA02|AA 002|David|Vuitton|address02|BB02|BB 003|Jean|Paul|address01|AA03|AA And i need an output…
Kapilnemo
  • 322
  • 4
  • 6