0

I'm debugging the JSON for a C# app that POSTs to CloudKit using server keys.

According to the docs, the JSON I need to use to create/modify a record looks like this:

{
    "operationType" : "create",
    "record" : {
        "recordType" : "Artist",
        "fields" : {
            "firstName" : {"value" : "Mei"},
            "lastName" : {"value" : "Chen"}
        }
        "recordName" : "Mei Chen"
    },
}

When I go to JSON2Csharp, I get the error below. I need to determine if the documentation is invalid, or if the server actually wants this JSON as-is.

enter image description here

Question

How can I obtain the JSON used in the apple CloudKit framework when it's sent to the CK server?

makerofthings7
  • 60,103
  • 53
  • 215
  • 448

1 Answers1

0

Your JSON doesn't appear to be formatted properly.

Please see if this fits your needs, as I believe it to be correctly formatted and structured to what you are working with:

{
    "operationType" : "create",
    "record" : 
    {
        "recordType" : "Artist",
        "fields" : 
        {
            "firstName" : {"value" : "Mei"},
            "lastName" : {"value" : "Chen"}
        },
        "recordName" : "Mei Chen"
    }
}
gravity
  • 2,175
  • 2
  • 26
  • 34
  • I'll give it a shot. The JSON is straight from Apple's documentation. My goal is to figure out what is the right format the servers are expecting. – makerofthings7 Apr 03 '17 at 18:03
  • The example from their documentation may simply be wrong. You definitely need a `,` before the `recordName`, as that's part of the `record` group. You do NOT need a `,` between the final two brackets, as there are no additional fields mentioned. – gravity Apr 03 '17 at 18:05