How can I check that an entity already exists remotely ?
In theory you could write some CloudKit code to execute a
CKQueryOperation that checks for your seed content. But that won't handle the race between a device exporting the data and another device launching the app and parsing the json file.
You can also check if records exist in the local store using
NSFetchRequest. However for the same reason that won't prevent you from inserting duplicate records on multiple devices if they haven't synced with the CloudKit server yet.
There are a number of approaches to "seeding" your application store with content in a reliable way:
Don't sync the seed content, instead use an un-synced store to hold the data from the JSON file and a synced store to hold user data
Unique the seed content on each device as it is updated by NSPersistentCloudKitContainer
Unfortunately
NSPersistentCloudKitContainer does not support unique constraints yet, you can file a feedback request for that though.