Last active
August 29, 2015 14:04
-
-
Save tomkersten/ff19bdf00fa6f5a41ac4 to your computer and use it in GitHub Desktop.
JS Object -> UBER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'identifier': '3220l', | |
'name': 'Deck chair', | |
'tidbit': 'You sit on it' | |
'description': '1-2 sentences of descriptive text. Right here.' | |
'specification': '[...a really long chunk of structured text...]' | |
'related_products': [ | |
{ | |
id: 'c7028k', | |
name: 'Deck table' | |
}, | |
{ | |
id: 'c38208', | |
name: 'Tiki torch' | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume this is the response from a request | |
// to 'http://example.org/products/3220l', which is an | |
// endpoint for the product represented in orig.json | |
{ | |
uber: { | |
version: '1.0', | |
data: [ | |
{ | |
rel: ['self'], | |
url: 'http://example.org/products/3220l' | |
}, | |
{ | |
name: 'products', | |
rel: ['collection'], | |
url: 'http://example.org/products' | |
}, | |
{ | |
name: 'product', | |
rel: ['item', 'http://example.org/rels/product'], | |
url: 'http://example.org/products/3220l', | |
data: [ | |
{ | |
name: 'identifier', | |
value: '3220l', | |
}, | |
{ | |
name: 'name', | |
value: 'Deck chair', | |
}, | |
{ | |
name: 'summary', | |
value: 'You sit on it' | |
}, | |
{ | |
name: 'description', | |
value: '1-2 sentences of descriptive text. Right here.' | |
}, | |
{ | |
id: 'productSpec-3220l' | |
name: 'specifications', | |
rel: ['productSpecification', 'http://example.org/res/productSpecification'] | |
url: 'http://example.org/products/3220l/specifications', | |
transclude: 'true' | |
} | |
{ | |
name: 'associated_products', | |
data: [ | |
{ | |
id: 'product-c7028k', | |
rel: ['product', 'http://example.org/rels/product'], | |
url: 'http://example.org/products/c7028k', | |
data: [ | |
{ | |
name: 'name', | |
value: 'Deck table' | |
}, | |
{ | |
name: 'id', | |
value: 'c7028k' | |
} | |
] | |
}, | |
{ | |
id: 'concept-c38208', | |
rel: ['product', 'http://example.org/rels/product'], | |
url: 'http://example.org/products/c38208', | |
data: [ | |
{ | |
name: 'name', | |
value: 'Tiki torch' | |
}, | |
{ | |
name: 'id', | |
value: 'c38208' | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment