Changes between Version 70 and Version 71 of pyson


Ignore:
Timestamp:
07/05/23 14:45:04 (17 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyson

    v70 v71  
    7070
    7171=== Dict Keys
    72 Keys of dictionaries/maps are restricted to strings only.
    73 To work around this restriction, pyson recognises from your specified type (eg {{{Dict[MyObject, str]}}}) whether the key is an object. In that case, the string key in the json dict is assumed to contain a string that can be parsed as json. The string is thus parsed as json object, and then further parsed as MyObject as usual.
     72In JSON, keys of dictionaries/maps are restricted to strings. In Python however, dicts usually contain general objects as keys.
     73
     74To work around this JSON restriction, pyson recognises from your specified type (eg {{{Dict[MyObject, str]}}}) whether the key is an object. In that case, a conversion is done between the python object (MyObject) and a json string, recursively using the standard pyson parse and toJson functions.
    7475
    7576=== Exceptions