olosegres/jsona

Object with key 'type'

glutaminefree opened this issue · 1 comments

Hi!
What if object itselfs have field with key type?
How to read/write to it?

For example:

{
  "data": {
    "type": "schedules",
    "attributes": {
      "type": "ON",
      "day": "DAY",
      "date": "2019-01-16",
      "time": "13:15"
    },
    "relationships": {
      "webinar": {
        "data": {
          "id": "78bf418f-3f6c-4cbe-a191-635880f6f049",
          "type": "webinar"
        }
      }
    }
  },
  "included": [{
    "id": "78bf418f-3f6c-4cbe-a191-635880f6f049",
    "type": "webinar",
    "attributes": {}
  }]
}

Hi! Create your own property mappers and rename one of type field during serialize/deserialize. Start point to understand how to do it - “Customize” section of readme.md