Json datastructure

Hi there… This is my first foray into Jsonitems. If i understand correctly, you can create a datastructure for a jsonitem… send it via something like ICPComsocket and read it as names…

for example

dim j as new JSONItem j.Value("Command")=commands j.Value("File") = f.NativePath j.Value("tempo") = tempo j.Value("Volume") = MovieVolume j.Compact=true dim s as string msgbox s SROptions.CommSocket.Write(s)

and then on the recieving end…(where s=the string created

Dim r As New JSONItem
r.Load(s)

msgbox r.value(“Command”)

I imagine it doesn’t really fly like that as even creating the s string = “”

how should it really go?

In you first block of code, you forgot to assign the JSON as string to s.

dim s as string = j.ToString

When loading, you can also do this:

dim r as new JSONItem( s )

Otherwise, you got it.

JSON has had a lot of work in the new Xojo structure, so I would suggest you look at http://developer.xojo.com/xojo-data.

I got it working - and it is awesome!
As for the new new Xojo Structure, I’m still using 2014.1 - but loving the json methods!

You can download & learn the new structure without purchasing (unless you want to build). I think the step up is worth the purchase.

I too recommend the new framework JSON handling. In the meantime, if you are going to use JSONItem, consider using my free JSONItem_MTC replacement instead. It’s the same API, but adds features, is faster, and fixes some bugs in the native JSONItem.

https://github.com/ktekinay/JSONItem_MTC

Well, since I have got it working awesomely - I don’t need the upgrade :slight_smile:
I was using it to send to a midi helper app I made because the usual movie player doesn’t have rate control (which my software used to rely on quicktime for)