# Upload file with json to ipfs (best way ? )

**URL:** <https://discuss.ipfs.tech/t/upload-file-with-json-to-ipfs-best-way/11405>\
**Category:** Uncategorized\
**Created:** [May 28, 2021, 4:55pm UTC](https://discuss.ipfs.tech/t/upload-file-with-json-to-ipfs-best-way/11405 "2021-05-28T16:55:36Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![novaknole](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@novaknole](https://discuss.ipfs.tech/u/novaknole)\
**Post date:** [May 28, 2021, 4:55pm UTC](https://discuss.ipfs.tech/t/upload-file-with-json-to-ipfs-best-way/11405/1 "2021-05-28T16:55:36Z")

</div>

I have a file which I want to upload to ipfs, but with the file, i also want to upload a string. So, JSON seems to be a good way.

```auto
const finalData = {
   title: 'title here',
   data: HTMLInputFileElement
}

```

Question 1. Can I pass this `data` to ipfs and get one cid ? the problem is that I think the file in `data` property won’t be uploaded and this is a problem. So The only choice I have is that first I upload the file, get the CID, put the `CID` inside `data` key and then upload `finalData` again to ipfs and get another cid.

The problem is that when I query CID, I have to first get a json and then query ipfs again for `data` in order to get a file. Isn’t there a better way not to do this 2 things ? is there any other choice to achieve what I want ?

---

_[View the full topic](https://discuss.ipfs.tech/t/upload-file-with-json-to-ipfs-best-way/11405)._
