WordPress Custom Rest Api – How to get Image Url?

$post->ad_1[0]['top_image'] will not return you data, because you are not in JS which got response from your REST api which had injected ad_1 value into object which it returns to you.

In your PHP code $post is of type WP_Post and it doesn’t have ad_1 in it, that’s why you getting nulls. I don’t know what ad_1 is in your data structure. Maybe it’s ACF field or just metafield, if it’s ACF you need to access it like get_field( 'ad_1', $post ).

Check your code which injects ad_1 value into your current REST route which responds with single item, and do the same for bulk.