JSON data Export and import

I have keys and values which I want to convert it to JSON objects and save in text file from grasshopper . and I want to import it from the text file in grasshopper and get the same data .
any plugin for that
json question.gh (4.4 KB)

It’s quite simple to read and write JSON with GHPython. Here’s a quick example demonstrating the json functions one needs:

For a non-native solution, you can use jSwan:

json question 1.gh (6.0 KB)
I tried to serialize in jswan , save it into file , reads the file again and deserialize , but didn’t work . I attached the file here

Maybe you need to repeat the list of keys for each branch?

json question_2022Jan22a.gh (10.4 KB)

But your keys are just a sequential list of integers, basically index values for an array and otherwise useless. So what you have is five arrays (branches).

P.S. Simple Python for converting each branch into a JSON array.

import json

JSON = json.dumps(x)

json question_2022Jan22b.gh (11.0 KB)

1 Like

@Joseph_Oster you solution miss important issue , which is the headers for the values in JSON file