Dexie.js
Dexie.js copied to clipboard
How to convert json blob to json
I want to convert this:
const blob = await exportDB(db, { prettyJson: true });
To readable json.
Instead I get:
Blob {size: 5646, type: "text/json"}
Thank you.
I found an answer. It uses the file reader.
Is there a "Dexie.js specific" way that I can do this ?
Here is what works:
const fr = new FileReader();
fr.addEventListener("load", e => {
console.log(e.target.result, JSON.parse(fr.result))
});
fr.readAsText(blob);
Theres sugar for that. Would probably be useful.
To convert blob to json use
let jsonString = await blob.text()
let json = JSON.parse(jsonString)
Does this require a pull requests to implement? (I am new to this repo)
If so, @MishaAkram , did you want to create the pull request?
If so and @MishaAkram is not planning on creating a pull request, I am happy to do that. I am looking for a first issue to contribute to.
@JamieBort I don't intend to create a PR out of it, just shared a general solution
Thanks for the quick response, @MishaAkram. Does anyone know who to contact about this? For example, is there a team of maintainers?