Skip to content
  • Michael Hanselmann's avatar
    serializer: Fail if dictionary uses invalid keys · fd0351ae
    Michael Hanselmann authored
    
    
    JSON only supports a very restricted set of types for dictionary keys,
    among them strings, booleans and “null”. Integers and floats are
    converted to strings. Since this can cause a lot of confusion in Python,
    this check raises an exception if a caller tries to use such types.
    
    Since the pre-Python 2.6 “simplejson” module doesn't support overriding
    the function where the conversion takes place this check can only be
    done for the newer “json” module.
    
    Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
    fd0351ae