1
"_type": "bibdataset",
"_children": [
        {
          "_type": "item",
          "_children": [
            {
              "_type": "process-info",
              "_children": [
                {
                  "_type": "date-delivered",
                  "month": "05",
                  "day": "02",
                  "year": "2021",
                  "timestamp": "2021-05-02T10:20:57.000057-04:00"
                },

json_data = pd.read_json("D:/jsn.json")

json_list = [j[1][0] for j in json_data.iterrows()]

Tried ,but returns with error --- ValueError: Expected object or value

dbc
  • 104,963
  • 20
  • 228
  • 340
antonyj453
  • 17
  • 7

3 Answers3

0

First, your code need put library - import pandas as pd

import pandas as pd
df = pd.read_json (r'C:\Users\Everton\Desktop\Test\Product_List.json')
df.to_csv (r'C:\Users\Everton\Desktop\Test\New_Products.csv', index = None)
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
Everton P M A
  • 159
  • 1
  • 7
0

First, check your JSON data and validate it doesn't have any format error. Then open it with pandas and explore it to define the data you want to save as a CSV. Then check this documentation about saving dataframes as CSV files.

Pandas Documentation - Saving DataFrames to CSV

Ivan Verges
  • 595
  • 3
  • 10
  • 25
0

I do not have enough reputation to leave a comment but alas. With the level of nested items in your JSON, I would not suggest saving it as a CSV by simply using .to_csv(). If you are adamant about saving your JSON file to a CSV then try to flatten it first (how to flatten a JSON file to CSV). I would also suggest looking into other methods of saving your data, maybe MySQL or MS Access even.

Hardgut
  • 1
  • 2