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!
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!
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.
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.
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 You can call adder.add(io.Reader)
to add from a Reader stream.
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.
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
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.
Thank you! Let me go through these.
For reference, https://web3.storage and https://nft.storage are the same team, providing IPFS services and persistence to Filecoin.
Boris, do you know if I could send data in json format to web3.storage without having to send a dot json file?
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
OK. Could I store a blob in web3.storage?
Best to look through the docs of their API
See
Thank you for the pointers.