Skip to content

Instantly share code, notes, and snippets.

@hampelm
Created April 10, 2012 23:40
Show Gist options
  • Save hampelm/2355659 to your computer and use it in GitHub Desktop.
Save hampelm/2355659 to your computer and use it in GitHub Desktop.
Proposed response structure
// I feel like the responses datatype should be simplified from its current form, pasted here:
var data = {
responses: [
{ parcels: [ {parcel_id: '10', responses: {'Q0': 0, 'Q1': 3}} ] },
{ parcels: [ {parcel_id: '11', responses: {'Q0': 1, 'Q1': 4}} ] }
]
};
// To one without the additional {parcels: } object, which doesn't seem to add much:
var data = {
responses: [
{parcel_id: '10', responses: {'Q0': 0, 'Q1': 3}},
{parcel_id: '11', responses: {'Q0': 0, 'Q1': 3}},
{parcel_id: '12', responses: {'Q0': 0, 'Q1': 3}},
]
};
// Alternately, we could make parcel_id a list:
var data = {
responses: [
{parcel_ids: ['10', '11'], responses: {'Q0': 0, 'Q1': 3}},
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment