mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Import a complex JSON #28
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @brosnic on GitHub (Jan 14, 2016).
What's the suggested way to import a complex JSON?
Example:
JSON from Webservice:
CoreData Entities:
ConnectionInfo:
attributes:
relationships:
Connection:
attributes:
relationships:
and so on.
Is there a way to still use transaction.importObjects(Into(ConnectionInfo), source: jsonDictionary)?
@JohnEstropia commented on GitHub (Jan 14, 2016):
@brosnic Sure it should work. If you check methods for the
ImportableObjectandImportableUniqueObjectprotocols, the transaction is always passed:This lets you do nested imports inside your implementation. Something like this:
@brosnic commented on GitHub (Jan 14, 2016):
Thank you!
@ro22e0 commented on GitHub (Mar 21, 2017):
Hello,
I want to set relationship but I don't know how to deal with NSSet and importUniqueObjects
Thanks in advance,
@JohnEstropia commented on GitHub (Mar 22, 2017):
@ro22e0 Hi, I'm not sure which one is your use-case, but here are examples.
@ro22e0 commented on GitHub (Mar 23, 2017):
Thanks a lot !