# Write json data

**URL:** <https://discuss.ipfs.tech/t/write-json-data/15204>\
**Category:** Help\
**Created:** [September 18, 2022, 3:58am UTC](https://discuss.ipfs.tech/t/write-json-data/15204 "2022-09-18T03:58:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 18, 2022, 3:58am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/1 "2022-09-18T03:58:10Z")

</div>

Hi,

Can I send json data to ipfs or does it always need to be in file?

Strangely, I haven’t found anything specific to json data yet, all links point to file.

Pointers to sample code would be very helpful because I’m new to this.

Thank you!

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [September 18, 2022, 2:32pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/2 "2022-09-18T14:32:26Z")

</div>

What exactly do you mean by “can I send json data to ipfs or does it always need to be in file”?

I’m just not clear about what you mean by it needing to be in a file.

There are two ways you can work with json data with IPFS, just a regular file or you can add it as IPLD.

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 18, 2022, 3:13pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/3 "2022-09-18T15:13:20Z")

</div>

Thank you for the response.

All the examples I looked at and/or found on the web was with sending the data in a dot json file. Hence, the question, if I could send raw json data to ipfs.

I am currently looking at using web3.storage as the provider and was trying to see if I can use it for this purpose.

That said, if you could point me to some documentation / sample code it will be very helpful

Thank you.

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [September 18, 2022, 3:35pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/4 "2022-09-18T15:35:49Z")

</div>

I’m not familiar with we3.storage. Are you looking to switch from web3.storage to IPFS?

From the command line the `ipfs add` command can read from stdin. If you’re using Kubo this page might help [kubo/add-code-flow.md at master · ipfs/kubo · GitHub](https://github.com/ipfs/kubo/blob/master/docs/add-code-flow.md) You can call `adder.add(io.Reader)` to add from a Reader stream.

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 18, 2022, 3:39pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/5 "2022-09-18T15:39:35Z")

</div>

I am basically willing to do anything or use any provider that would help me add data in json to ipfs. To answer your question, I’m willing to make the move from web3.storage to ipfs.

I am building a Dapp therefore, need to do this in nodejs.

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [September 18, 2022, 3:49pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/6 "2022-09-18T15:49:22Z")

</div>

Then you’ll want to use js-ipfs. See the documentation here [interface-js-ipfs-core/FILES.md at master · ipfs-inactive/interface-js-ipfs-core · GitHub](https://github.com/ipfs-inactive/interface-js-ipfs-core/blob/master/SPEC/FILES.md#add)

There are two ways to add json to IPFS. You can just add it as a file. In that case there’s nothing special about it. It’s just a file that happens to be json. Alternatively you can add it as IPLD in which case you can add links and navigate paths through the json content and links.

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 18, 2022, 4:02pm UTC](https://discuss.ipfs.tech/t/write-json-data/15204/7 "2022-09-18T16:02:26Z")

</div>

Thank you! Let me go through these.

---

<div class="post-metadata">

**Author:** ![boris](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/boris/32/6632_2.png) [@boris](https://discuss.ipfs.tech/u/boris)\
**Post date:** [September 19, 2022, 6:31am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/8 "2022-09-19T06:31:47Z")

</div>

For reference, [https://web3.storage](https://web3.storage) and [https://nft.storage](https://nft.storage) are the same team, providing IPFS services and persistence to Filecoin.

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 19, 2022, 7:15am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/9 "2022-09-19T07:15:29Z")

</div>

Boris, do you know if I could send data in json format to web3.storage without having to send a dot json file?

---

<div class="post-metadata">

**Author:** ![boris](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/boris/32/6632_2.png) [@boris](https://discuss.ipfs.tech/u/boris)\
**Post date:** [September 19, 2022, 7:19am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/10 "2022-09-19T07:19:41Z")

</div>

None of the IPFS services are databases so no — you need to create and send a `file.json` if you want to store JSON data.

You can store structured data in #ipld — but that’s an advanced topic [IPLD ♦ Docs](https://ipld.io/docs/)

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 19, 2022, 7:22am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/11 "2022-09-19T07:22:15Z")

</div>

OK. Could I store a blob in web3.storage?

---

<div class="post-metadata">

**Author:** ![boris](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/boris/32/6632_2.png) [@boris](https://discuss.ipfs.tech/u/boris)\
**Post date:** [September 19, 2022, 7:26am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/12 "2022-09-19T07:26:25Z")

</div>

Best to look through the docs of their API

See

- [Web3 Storage - The simple file storage service for IPFS & Filecoin.](https://web3.storage/docs/how-tos/store/)
- [Web3 Storage - The simple file storage service for IPFS & Filecoin.](https://web3.storage/docs/reference/js-client-library/)

---

<div class="post-metadata">

**Author:** ![roger](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/roger/32/6939_2.png) [@roger](https://discuss.ipfs.tech/u/roger)\
**Post date:** [September 19, 2022, 9:49am UTC](https://discuss.ipfs.tech/t/write-json-data/15204/13 "2022-09-19T09:49:03Z")

</div>

Thank you for the pointers.
