Exporting schedules to JSON

Hello everyone

I’m trying to export a schedule to JSON format instead of CSV
I read that it can be done using pyRevit, but couldn’t find specific instructions

Would appreciate any help

Thank u

@RotemMidved Hi, and welcome

you will find what you need with this link script module - dump_json / load_json- pyRevit

Merci beaucoup Jean-Marc

So this is the code i guess to perform the action i want
Can u direct me to where i can find information and help on how to implement this?

Greetings

Usually when you expand the source code in the link I provided you get more info about inputs, output and eventually code samples.

you can also look for similar code in the pyrevit codebase like so Code search results and get lucky

if not, enlarge your search in github Code search results
second result is close enough in this example

here is a dumb sample

from pyrevit import script

data = {"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}

json_filepath = "C:\......"
script.dump_json(data, json_filepath)