Comment Comment by Arkadir > structure = json.loads(json_string)Not quite. Let's say your JSON data contains the following attribute: "access" : [ "view", "edit", "admin" ], This field should be represented (in the language) as a set of values from an "access-levels" enumeration.In C#, you'd have the following boilerplate: [DataMember(Name = "access")] public HashSet<AccessLevels> Access { get; private set; } In OCaml, it would be: access : Access.Set.t ; The simple "json.loads" solution would return a list of strings instead. What's the Python code for turning it into a set of enumeration values, and failing if one of the values does not match ? parent Arkadir 12 years ago
Not quite. Let's say your JSON data contains the following attribute:
This field should be represented (in the language) as a set of values from an "access-levels" enumeration.In C#, you'd have the following boilerplate:
In OCaml, it would be: The simple "json.loads" solution would return a list of strings instead. What's the Python code for turning it into a set of enumeration values, and failing if one of the values does not match ?