0

Suppose I have a json response like this -

{
"status": {
    "status": "Success"
},
"forecastDetails": [
    {
        "stageName": "Upside",
        "percent": 99.92,
        "amount": 16411537
    },
    {
        "stageName": "Commit",
        "percent": 0.08,
        "amount": 13843
    },
    {
        "stageName": "Won",
        "percent": 0,
        "amount": 0
    },
    {
        "stageName": "Strong Upside",
        "percent": 0,
        "amount": 0
    },
    {
        "stageName": "Submitted",
        "percent": 0,
        "amount": 0
    }
],
"totalAmount": 16425380,
"totalPercent": 100
}

How should I handle this case when mapping the json to iOS Core Data? How to design models and have relationship between them?

letsbondiway
  • 470
  • 3
  • 18
  • I have two entities as of now - Forecast with totalAmount and totalPercent as attributes and ForecastDetails with stageName, percent and amount as attributes. After this, I didn't get a hold of the type of relationship I should have between the 2 identities. Also, I was wondering if I could use single entity for this which I fear would not be possible. – letsbondiway Oct 05 '15 at 03:32
  • A one-to-many from forecast to details. Have you looked at restkit? – Wain Oct 05 '15 at 06:36

0 Answers0