immersivecognition/unity-experiment-framework

saving dictionaries (same as lists?)

Closed this issue · 2 comments

I'm working on a project using UXF (thank you, it's great!) and I stumbled across this quirk that I wanted to better understand, because it seemed like a mistake but maybe it isn't:

to save a List or a Dictionary, you use the same method, "trial/session.HandleJSONSerializableObject". I'm learning c# mostly via working my way through UXF and other tutorials, but I was wondering if this was intentional, and if so, why?

Thanks!

Hi! Glad you like UXF. This is intentional because these methods are designed to save data in a JSON-like format.

https://en.wikipedia.org/wiki/JSON#Syntax

JSON can be either a list or a dictionary in C# terms. You can have lists of objects, numbers, strings, or dictionaries, or even dictionaries of lists, other dictionaries, etc. UXF will save them all.

If you want to save a literal "list" of values you may be better of saving a UXFDataTable, which is data in the structure of a spreadsheet.

awesome, good to know! happy to learn!

cheers