N
N
Nice_932017-04-27 17:00:58
JavaScript
Nice_93, 2017-04-27 17:00:58

Is it possible to use such JSON in EmberJS JSONAPISerializer?

{
  "data": {
    "surveys": [
      {
        "id": 27,
        "shortcode": "rk",
        "question": "test test",
        "date_start": "2016-05-18 01:15:00",
        "date_end": "2016-05-18 01:20:00",
        "is_private": "No",
        "votes": 0
      },
      {
        "id": 28,
        "shortcode": "je",
        "question": "test test",
        "date_start": "2016-05-18 01:15:00",
        "date_end": "2016-05-18 01:20:00",
        "is_private": "No",
        "votes": 0
      },
      {
        "id": 39,
        "shortcode": "2a",
        "question": "test?",
        "date_start": "2016-05-30 03:00:00",
        "date_end": "2016-05-30 03:15:00",
        "is_private": "No",
        "votes": 0
      }
    ],
    "total_records": "38"
  },
  "errors": [],
  "success": true
}

Or with some other one? I will be glad to any advice to change Json, I can’t, I need a solution specifically for it,
how can I return such a JSON through the Serializer array model?
returns this error
while processing route: surveys Assertion Failed: Encountered a resource object with an undefined type (resolved resource using [email protected]:surveys:) Error: Assertion Failed: Encountered a resource object with an undefined type (resolved resource using [email protected]:surveys:)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andy Developer, 2017-04-27
@Nice_93

yes, JSONAPISerializer expects data in JSON API specification format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question