Grasshopper

algorithmic modeling for Rhino

I've done some searching around, but it all seems related to Xively (Cosm, Pachube).  Does anyone know of a way to read JSON data from a local file (remote may work too) in Grasshopper?

Thanks,

Adam

Views: 6432

Replies to This Discussion

Python has a built-in JSON encoder/decoder module, which you can implement in a GHPython component. Have attached a simple example. Hope that helps..

Attachments:

Thank you Anders!

I will give this a shot as soon as I can.

Again, thanks!

The example file works, when I try to read my own JSON, I am getting an GDI+ error.

Anybody knows what's wrong here?

Attachments:

If you unwire the out parameter from the panel it works. You can open the Python component to inspect and manipulate the data from there. I think the drawing error is caused by sending a really large string from "out" to the panel that it is not capable of handling.

Yea, panel can't handle long strings. 

It may get a little better if you split the string into some smaller portions (items on a list) and then display it as a list of strings. 

Hey Mateusz,

Is there an example of writing a DataTree or a list to json file? 

Thanks! 

Konrad, this post may be interesting to you: http://lmnts.lmnarchitects.com/fabrication/grasshopper-to-d3js/

You could also use the Python json module as seen here..

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service