JSON API Plugin not showing Attachments id reused

So there are several ways images can be “related” to post:

  1. When you upload image in post context that post is set as its parent (that is parent field of image attachments post has post’s ID).
  2. When you set image as a featured on a post (or use similar functionality from custom fields frameworks) the post records image attachment’s ID in it its meta.
  3. When you insert image into post content, the details of image attachment’s post are used to produce the markup.

Out of these the third one is the weakest to work with by code. If the only established link is the HTML markup with the URL to image then it is challenging to parse it out and reverse into meaningful ID. Not impossible, but it’s a mess.

If you have very specific use case like single image associated with the post for special purpose, then you should be using featured images or similar approach to work with IDs.