JSON Manipulation in Dynamo

I’m looking for a way to manipulate JSON data. I’ve been using JsonData package by @alvpickmans up to this point but would like a way to do some more complex manipulation (specifically with arrays in the json objects). I’m wondering if there is a way to convert the Newtonsoft.Json .NET library into a zero touch package or use the python json module without having to install it on each computer the graph will be running on.

1 Like

Python it :wink:
Seems like Newtonsoft wont import a la ZT which leaves Python as your best option, plus Newtonsoft methods and features are orientated around text-based programming paradigms so if you have complex requirements it would be the best way to go.

2 Likes

Well, for cheap coffee I’m happy to spend time implementing those reqs into JsonData package :wink:

5 Likes

Is there an embedded python library that could deal with JSON? If I’m sending this to other users, I don’t want to have to tell them how to install an iron python module on their computer.

1 Like

Python does have its own JSON package but I’ve only ever used Newtonsoft so cant give you any more advice than this but i guess its your best option as this library is pre-installed with Python:

import json

You need to add a new reference path too so add these lines to your imports:
import sys
path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
import json

On the good news front, looks like there is no need to add the reference path from Dynamo Sandbox 2.8 on - perhaps even earlier (on my personal laptop with nothing much installed on it so I can’t test).

Also good news, the documentation for this library is quite robust.

2 Likes

Wow, this is great news. That definitely makes it simple. Thanks @jacob.small!

1 Like