Learn Courses My Dashboard

Core Data + JSON Exporting + Multimedia

Quick Question, I just want to validate if this is possible under swifttui:

My Core Data will contain image binary, I want to export it to JSON, is it possible?
Can my Core Data save audio binary? can it be exported to JSON also?

Not directly to JSON. JSON is for saving text mainly, you can reference the image data by uploading to a server, and the JSON can hold that reference

But you don’t directly save image data to JSON

1 Like

To build on what @mikaelacaron said…

It is possible to save video/audio data to JSON, but inadvisable in most cases. Since JSON doesn’t directly support raw data, you would need to convert the data to a Base64-encoded string (or some other kind of data-to-string encoding) and then save that string to the JSON. (And, of course, reverse the process for decoding.) And it would balloon the size of your JSON quite a bit. Unless you have a really compelling use case for doing so, I would avoid it.

1 Like

Thanks for the info @roosterboy I forgot that’s possible, but like you said inadvisable

thank you @roosterboy and @mikaelacaron for the info.I appreciated it. So I think I will go for the cloud solution.