1

I have a Github page, which uses, of course, Jekyll. I have already embedded there pdf file that I have in the system with this code:

<object data="img/mypdf.pdf" type="application/pdf" width="1000px" height="800px">
</object>

Now I need to preview the json file in a similar way, but I can`t find a way for it to work. I have already this:

<a href="docs/myjson.json" download>Click to open (or right-click and "Save link as") </a>

I would like to avoid copying the content and pasting it on the page every time. It would be much easier if the content from json file is embedded and it would "preview" on the page every time myjson.json is replaced. Can you help me?

  • You have to load the JSON as object and check [this question](https://stackoverflow.com/questions/4810841/pretty-print-json-using-javascript) for convert it to sreing and add it to the DOM. – seenukarthi Sep 29 '20 at 08:20
  • With "load the JSON as object" you mean something similar to the pdf embedding? : – Santa Ozoliņa Sep 30 '20 at 06:13
  • Not like that you have to use XHR to load the json in to object and display it. – seenukarthi Sep 30 '20 at 06:39
  • Seems very complicated all the information together - I`ve never heard or done anything with XHR yet and the information in the question you tagged (I guess) is in the javascript, correct? Do you think it will be possible to integrate the javascript in the markdown file later? – Santa Ozoliņa Oct 01 '20 at 12:42

0 Answers0