Receive Image data as JSON and injecting it into the DOM

后端 未结 3 439
有刺的猬
有刺的猬 2021-02-01 05:53

I am packaging an image into jSON and sending it to the client .... On the client side I wish to display this data as a image ...

I am not sending the Image URL via JSO

3条回答
  •  执笔经年
    2021-02-01 06:32

    You cannot send binary data to the browser inside JSON.

    You can use b64 encoding and the DataURI (MDC) (Wikipedia) in a browser that understands it

    Since the comments that came after my post all have an actual example, here is one from Wikipedia:
    Red dot

    Alternatively convert to SVG which is also textual

提交回复
热议问题