I am not experienced in Python and getting confused by data types.

I'm receiving an Int32 type field from ROS (<http://wiki.ros.org/msg>) which I need to make to be part of a JSON, but the json.dumps fails due to the Int32 type:

> 
> json.dumps(angle)  
> 
>  TypeError: data: 72 is not JSON serializable
> 
> 
> 

Casting Int32 to integer fails too, for example when using:

> 
> angle = int(angle or 0)  
> 
>  TypeError: int() argument must be a string or a number, not 'Int32'
> 
> 
> 

Is there a way to change the type of a variable from a custom type to a standard one? I cannot change the source where I'm receiving it.

EDIT: Thanks to others pointing out, the error messages were actually telling "TypeError: data: 72 is not JSON serializable" - shows that this variable actually has the value of "data: 72", while due to my inexperience with Python I thought that the "data:" part of the error message was from the error and not from the variable. I guess it would be more obvious if it would be using quotes:

> 
> TypeError: "data: 72" is not JSON serializable
> 
> 
> 

Anyhow, this is obviously a rookie mistake. Apologies.