fix: flatten UUID to str for make_json_safe()
				
					
				
			This commit is contained in:
		
							parent
							
								
									663f438e4e
								
							
						
					
					
						commit
						18484a72ac
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		|  | @ -27,6 +27,7 @@ Web Utilities | |||
| import importlib | ||||
| import json | ||||
| import logging | ||||
| import uuid as _uuid | ||||
| import warnings | ||||
| 
 | ||||
| import sqlalchemy as sa | ||||
|  | @ -531,6 +532,10 @@ def make_json_safe(value, key=None, warn=True): | |||
|             parent[key] = make_json_safe(value, key=key, warn=warn) | ||||
|         value = parent | ||||
| 
 | ||||
|     # convert UUID to str | ||||
|     if isinstance(value, _uuid.UUID): | ||||
|         value = value.hex | ||||
| 
 | ||||
|     # ensure JSON-compatibility, warn if problems | ||||
|     try: | ||||
|         json.dumps(value) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue