Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4159

Converting JSON to CSV

$
0
0

Hi, i’m trying to convert JSON to CSV. So far i have the following code, which i mostly found here.

#! python3
# r: numpy, pandas, json

import rhinoscriptsyntax as rs
import pandas as pd
import json as json

# Reading JSON data from a file
with open("data.json") as f:
    json_data = json.load(f)

# Converting JSON data to a pandas DataFrame
df = pd.read_json(json_data)

# Writing DataFrame to a CSV file
df.to_csv("output.csv", index=False)

It throws up the error:

  1. Error building code | Error installing: json | ERROR: Could not find a version that satisfies the requirement json (from versions: none)ERROR: No matching distribution found for json

Tried switching load.json to json.load, which seemed logical to me but i’m a novice and it didn’t work, so probably that wasn’t it.

What am i doing wrong? Please advice

23 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 4159

Latest Images

Trending Articles



Latest Images