How to get AI to throw object over obstacles

What I am trying to do is to get the the AI to throw a grenade over an obstacle to its target. What I have so far is just having the AI throw a grenade at the target which works fine but I have no idea how to get it to think about the obstacles that are in the way like in the picture shown below. I want A to notice there is a wall in the middle and throw the object over it to be.

Vector2 diff = target.position - this.character.transform.position;
        Vector2 grenadeVel = new Vector2();
        grenadeVel.x = diff.x / grendadeDetonationTime ;
        grenadeVel.y = (diff.y - 0.5f * worldGravity.y * grendadeDetonationTime *   grendadeDetonationTime ) / grendadeDetonationTime ;

        Debug.Log(grenadeVel);
        World.Instance.WeaponManager.Grenade.Throw(this.character, grenadeVel);

Im not really asking for code (although it would be great), what I want is some advice/ tips on how to implement this and what the logic might be like. Currently my game world is in 2D and it has a grid which I use for path finding with the A* algorithm, is it possible to do what I want using a world grid to create an arch over obstacles?

As ZefanS said,
First make a raycast from ai player to target area.
if raycast hits and object, change the angle (Unity - Scripting API: Quaternion.AngleAxis) of the raycast till it doesn’t hit anything.
Thats the point AI should throw the ball over.