Unity3D, Json, Javascript example

1,328 views
Skip to first unread message

DoubleDutch

unread,
Aug 10, 2011, 4:16:53 PM8/10/11
to JsonFx
I've read in many places now that JsonFX is the library of choice
whilst using json in Unity.

For the last 2 days - I've been trying to get find a simple example of
how to use this library in Unity using Javascript and I'm not really
getting anywhere.

For this test:

- I create a unity project with a javascript file which loads fine
- I have installed and imported JsonFX into that project
- I created s sample JSON object stored in a variable:

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

Using JsonFX I want to extract the various "menuitem" values from the
above string. If someone could give me 10 lines of code which do that
I would really appreciate it.

And if I'm not asking too much, 3 added lines which create a example
Json object which I can send back to my server would be even nicer.

I really appreciate it.

vude

unread,
Oct 3, 2011, 11:38:00 AM10/3/11
to JsonFx
I would like to second that but on the C# side. There are some
excellent examples on the front page at github (https://github.com/
jsonfx/jsonfx) but I'm having difficulty at runtime in an Xcode
project for an iOS app that I'm currently working on. I've read that
the signed libraries include System.XML and that by removing the XML
stuff it should run without errors but that hasn't been the case thus
far.
Reply all
Reply to author
Forward
0 new messages