var object = {
key: value
}
var planet = {
"name": "Saturn",
"planet_number": 6
}
var polygons = {
triangle: {
"sides": 3,
"color": "blue",
"types": [
{"name": "equilateral", "regular": true},
{"name": "isosceles", "regular": false},
{"name": "scalene", "regular": false}
]
},
quadrilateral: {
"sides": 4,
"some_other_thing": null
}
}
Used to generate a JSON API in Rails
Active Model Serializers
Swizzling
user_serializer.rb
Attributes (as a list of symbols)
users_controller.rb
{
"user": {
"id":10,
"email":"brigitte@allovue.com",
"admin":true
"principal":false,
"staff":false,
"first_name":"Brigitte",
"last_name":"Warner",
"phone":null,
"budget_lea_ids" [4]
}
}
10 E North Ave
We're Hiring!
http://allovue.com/about
careers@allovue.com