title: How can I properly upload json's contents to FPDF object?
body: <p>I'm working on strings like this below:</p>
  <pre><code>my_string = '{&quot;amountexvat&quot;:&quot;0.14&quot;,&quot;amountincvat&quot;:&quot;0.15&quot;,&quot;currency&quot;:&quot;EUR&quot;,&quot;paymentmethods&quot;:[{&quot;details&quot;:{&quot;acquirerapprovalcode&quot;:&quot;037464&quot;,&quot;acquirerid&quot;:&quot;A0000000031010&quot;,&quot;acquirerpoiid&quot;:&quot;gyytfft55&quot;,&quot;adyentransactionid&quot;:&quot;1234&quot;,&quot;adyentransactiontimestamp&quot;:&quot;2021-10-08T15:28:07.000Z&quot;,&quot;cardname&quot;:&quot;kll&quot;,&quot;cardtype&quot;:&quot;hhgh&quot;,&quot;entrymodes&quot;:[&quot;ICC&quot;],&quot;flourpaymentreference&quot;:&quot;889999&quot;,&quot;merchantid&quot;:&quot;888&quot;,&quot;paymentbrand&quot;:&quot;test&quot;,&quot;paymentvariant&quot;:&quot;visastandardcredit&quot;,&quot;poitransactionid&quot;:&quot;12345&quot;,&quot;poitransactionreconciliationid&quot;:&quot;1000&quot;,&quot;poitransactiontimestamp&quot;:&quot;2021-10-08T17:28:07.000Z&quot;,&quot;terminalid&quot;:&quot;866777&quot;,&quot;transactionamount&quot;:0.15,&quot;transactioncurrency&quot;:&quot;EUR&quot;},&quot;type&quot;:&quot;ec&quot;}],&quot;products&quot;:[{&quot;amount&quot;:1,&quot;baseprice&quot;:&quot;0.15&quot;,&quot;discount&quot;:&quot;0&quot;,&quot;discountedprice&quot;:null,&quot;itemvat&quot;:&quot;0.01&quot;,&quot;pricepaidexvat&quot;:&quot;0.14&quot;,&quot;pricepaidincvat&quot;:&quot;0.15&quot;,&quot;unit&quot;:&quot;piece&quot;,&quot;vendorchangedprice&quot;:true}],&quot;salevat&quot;:&quot;0.01&quot;}'
  </code></pre>
  <p>On the other hand I have FPDF object (to generate some report). I would like to upload json view from <code>my_string</code> to FPDF object.</p>
  <pre><code>import fpdf
  
  pdf = FPDF()
  
  #Cover page
  pdf.add_page()
  pdf.set_font('Arial', 'B', 16)
  pdf.cell(175, 10, 'TEST - report',0,1,'C')
  </code></pre>
  <p>Do you know how to handle it?</p>
  <p>Json view from <code>my_string</code> I mean this:</p>
  <p><a href="https://i.stack.imgur.com/MnPR6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MnPR6.png" alt="enter image description here" /></a></p>
  <p>I'm using jupyter notebook on EMR AWS and I tried save json file (based on <code>my_string</code>) to S3 bucket, later open json in read mode and insert text from that file to pdf.</p>
  <pre><code># save json to file in bucket
  s3 = boto3.client('s3')
  json_object = my_string
  s3.put_object(
       Body=json.dumps(json_object),
       Bucket='my_bucket',
       Key='my_key'
  )
  
  # open the json file in read mode
  s3client = boto3.client('s3')
   
  # create a file object using the bucket and object key
  fileobj = s3client.get_object(
      Bucket='my_bucket',
      Key='my_key'
      ) 
  
  # open the file object and read it into the variable filedata
  filedata = fileobj['Body'].read()
  
  # decode file
  contents = filedata.decode('latin-1') 
  
  # insert the texts in pdf
  for x in contents:
      pdf.cell(200, 10, txt = x, ln = 1, align = 'C')
  </code></pre>
  <p>Unfortunately it does not work as I would like (the text is saved in the pdf report but it is not in json format). Do you have an idea how to properly write json's contents to PFDF object?</p>
  <p>Thanks for any ideas.</p>