In Python, I can create objects from JSON pretty easily. I can either populate classes or just create a generic object. I see that Chapel has a read method for JSON, but I'm not sure how to use it.
If I have:
class Fighter {
var subclass:string;
var level:int;
}
and a string:
s = "{'subclass':'Ninja', 'level':7}"
How do I get a Fighter object?
And are there methods like:
n = json.loads(s)
n['subclass'] # = 'ninja', but just as a field key
Or:
Hattori = Fighter.read(s);
Hattori['subclass'] # = 'ninja'
Thanks!