Can't get the correct angle from Raycast?

I am trying to get the angle of this slope so I can use it to move the cube up the slope like in a 2D Plaformer. The inspector image the z rotation is about 31 which is the angle I require.

I’ve tried hitting it with a raycast and getting is z rotation like so:

RaycastHit2D right = Physics2D.Raycast(rightSensor, Vector2.down, velocity.y, groundMask);
angle = right.transform.gameObject.transform.rotation.z; 

but when I do the resulting angle is 0.27ish. Why would it not be 31? That’s the rotation of z in the scene when I check the object.

I’ve also tried using the hit normal a couple of ways:

 angle = Vector2.Angle(right.transform.gameObject.transform.position, Vector2.up);
 angle = Vector2.Angle(right.normal,Vector2.up);

No matter what I do I cannot get the correct angle for the platform and I KNOW I am hitting the right object as I’ve been over this in debug mode many times. Can some explain to me what I am doing wrong?

I figured it out. The reason why the Angle is wrong is because its in Quaternion instead of degrees. To get degrees use transform.eulerAngles.z.