Exporting animations as JSON blobs from Max


#1

Hi all,

Does anyone have examples they can share to export data from Max as JSON? Specifically, I’m looking into exporting animated values from Max as JSON data. Any examples to get started would help greatly.

Thanks for the help.


#2

Depending on the purpose of your export and what datas you need to collect, JSON is a simple text format so you just need to write down a script that will write in an external file the datas you need, and save it as a json


#3

hmm… do you really need JSON?

the thing is - JSON is good when you have a data that easily can be serialized to JSON format. If your data is abstract there is no really a reason to use json.
the best data for using json is a combination of dictionaries and arrays (including array of dictionaries).

that means to get a power of json using (which is serialization to and deserialization from) you have to put your data in an usable format.

i suggest you instead of using json to get a look at XML. the benefit of using this format is a fast way to parse XML data using XPATH

the good thing is that the MAX already can store animation data in XML with build-in save/load animation methods


#4

Thanks Redmond3DAnim. This was my fallback. I was hoping that there was a struct or system available to author JSON formatting from Max. I’ll post it when my version is ready.


#5

Thanks Denis. We have an editor which will only accpet JSON data for parsing data. We have XML parsing, but then there are more complications involved with getting things in order.

Brilliant. Thanks for the suggestion. What I might try is to export using XPATH, and then use Python to convert an XML into JSON by adding the entries into a dictionary.


#6

You can convert XML to JSON without leaving MAX. There are .NET built-in methods and you can call them using MXS


#7

Cool, thanks. Will look into it.