title: Best way to list image URLs in a json
body: <p>I know this is more of a python question than a fastAPI question. I want to know which method is the best way to list my image urls in a json and how to implement it in my json response.</p>
  <p>This is my current json data:</p>
  <pre><code>&quot;imgs_url&quot;: [
        &quot;http://10.0.2.2:8000/static/product_images/f3e6421737643e583a1d.jpg, http://10.0.2.2:8000/static/product_images/b53bf8aeb27d27a739cc.jpg, http://10.0.2.2:8000/static/product_images/75a80e7c04ebaed3e425.jpg&quot;
      ]
  </code></pre>
  <p>This is the python function i am using to get the firt list:</p>
  <pre><code>async def create(
      name: str = Form(...),
      price: float = Form(...),
      description: str = Form(...),
      files: List[UploadFile] = File(...),
      db: Session = Depends(get_db),
      current_user: Vendor = Depends(get_current_active_user)
  ):
      fileList = []
      for file in files:
          try:
              FILEPATH = &quot;./static/product_images/&quot;
              pimage_name = FILEPATH + imghex(file.filename)
              contents = await file.read()
              with open(pimage_name, 'wb') as f:
                  f.write(contents)
          except Exception:
              return {&quot;message&quot;: &quot;There was an error uploading the file(s)&quot;}
          finally:
              await file.close()
          # fileList.append(&quot;localhost:8000&quot; + pimage_name[1:])
          fileList.append(&quot;http://10.0.2.2:8000&quot; + pimage_name[1:])
  
      file_urls = &quot;, &quot;.join(fileList)
      new_item = Product(
          name=name,
          price=price,
          description=description,
          imgs_url=[file_urls],
          owner_id=current_user.id
      )
  
      db.add(new_item)
      db.commit()
      db.refresh(new_item)
      return new_item
  </code></pre>
  <p>How do i change the current list to this:</p>
  <pre><code>&quot;imgs_url&quot;: [
    &quot;http://10.0.2.2:8000/static/product_images/f3e6421737643e583a1d.jpg&quot;, 
    &quot;http://10.0.2.2:8000/static/product_images/b53bf8aeb27d27a739cc.jpg&quot;, 
    &quot;http://10.0.2.2:8000/static/product_images/75a80e7c04ebaed3e425.jpg&quot;
  ],
  </code></pre>
  <p>also this is another option for listing images:</p>
  <pre><code>&quot;imgs_url&quot; : [
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-1.jpg&quot;},
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-2.jpg&quot;},
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-3.jpg&quot;},
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-4.jpg&quot;},
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-5.jpg&quot;},
   {&quot;url&quot;:&quot;https://s3-us-west-2.amazonaws.com/appsdeveloperblog.com/images/cats/cat-6.jpg&quot;}
  ]
  </code></pre>
  <p>I have three questions:
  <strong>1)</strong> Please, how do i change to the second or the 3rd method?
  <strong>2)</strong> Which is the best method for lisiting images in a url?
  <strong>3)</strong> Is there an industry accepted standard for lisitng image urls in a json?</p>