Skip to content

Instantly share code, notes, and snippets.

@christocracy
Created June 19, 2011 18:55
Show Gist options
  • Select an option

  • Save christocracy/1034597 to your computer and use it in GitHub Desktop.

Select an option

Save christocracy/1034597 to your computer and use it in GitHub Desktop.
JSON Response for categories
// Your response uses XML-like nesting which is incompatible with Sencha's JsonReader.
[
{ // <----- no
"category": {
.
.
.
"tracks": [
{ // <------ no
"track": {
.
.
.
"answers": [
{ // <------- no
"answer": {...}
}
}
}
]
// Please format your response as follows:
[
{
"category_id": 1,
"category_name": "My Body",
"category_icon": "mybody",
"sort_order": 1,
"tracks": [
{
"track_id": 2,
"category_id": 1,
"question_text": "What's your favorite colour?",
"answers": [
{
"answer_id": 1,
"track_id": 2,
"answer_text": "red",
"sort_order": 1
},
{
"answer_id": 2,
"track_id": 2,
"answer_text": "blue",
"sort_order": 3
},
{
"answer_id": 3,
"track_id": 2,
"answer_text": "green",
"sort_order": 2
}
],
"sort_order": 3
},
{
"track_id": 3,
"category_id": 1,
"question_text": "How's the weather?",
"answers": [
{
"answer_id": 21,
"track_id": 3,
"answer_text": "poor",
"sort_order": 1
},
{
"answer_id": 22,
"track_id": 3,
"answer_text": "great",
"sort_order": 3
},
{
"answer_id": 23,
"track_id": 3,
"answer_text": "good",
"sort_order": 2
}
],
"user_answer_id": null,
"sort_order": 2
},
{
"track_id": 4,
"category_id": 1,
"question_text": "Do you like stuff?",
"answers": [
{
"answer_id": 11,
"track_id": 4,
"answer_text": "no",
"sort_order": 2
},
{
"answer_id": 12,
"track_id": 4,
"answer_text": "yes",
"sort_order": 1
}
],
"sort_order": 1
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment