Skip to content

Instantly share code, notes, and snippets.

@daschl
Created July 25, 2014 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daschl/5aed612c5e295dc15e62 to your computer and use it in GitHub Desktop.
Save daschl/5aed612c5e295dc15e62 to your computer and use it in GitHub Desktop.
I need to parse and emit every item of the result set and then individually the info block (example). Also the code needs to see if an error arises and do something else.
{
"error":
{
"caller": "standard:50",
"cause": "Parse Error - syntax error",
"code": 4100,
"key": "parse_error",
"message": "Parse Error"
}
}
{
"resultset": [
{
"address": [
"563 Second Street"
],
"city": "San Francisco",
"code": "94107",
"country": "United States",
"description": "The 21st Amendment Brewery offers a variety of award winning house made brews and American grilled cuisine in a comfortable loft like setting. Join us before and after Giants baseball games in our outdoor beer garden. A great location for functions and parties in our semi-private Brewers Loft. See you soon at the 21A!",
"geo": {
"accuracy": "ROOFTOP",
"lat": 37.7825,
"lon": -122.393
},
"name": "21st Amendment Brewery Cafe",
"phone": "1-415-369-0900",
"state": "California",
"type": "brewery",
"updated": "2010-10-24 13:54:07",
"website": "http://www.21st-amendment.com/"
},
{
"abv": 7.2,
"brewery_id": "21st_amendment_brewery_cafe",
"category": "North American Ale",
"description": "Deep golden color. Citrus and piney hop aromas. Assertive malt backbone supporting the overwhelming bitterness. Dry hopped in the fermenter with four types of hops giving an explosive hop aroma. Many refer to this IPA as Nectar of the Gods. Judge for yourself. Now Available in Cans!",
"ibu": 0,
"name": "21A IPA",
"srm": 0,
"style": "American-Style India Pale Ale",
"type": "beer",
"upc": 0,
"updated": "2010-07-22 20:00:20"
},
{
"abv": 5,
"brewery_id": "21st_amendment_brewery_cafe",
"category": "North American Ale",
"description": "Deep black color, toasted black burnt coffee flavors and aroma. Dispensed with Nitrogen through a slow-flow faucet giving it the characteristic cascading effect, resulting in a rich dense creamy head.",
"ibu": 0,
"name": "563 Stout",
"srm": 0,
"style": "American-Style Stout",
"type": "beer",
"upc": 0,
"updated": "2010-07-22 20:00:20"
},
{
"abv": 5.2,
"brewery_id": "21st_amendment_brewery_cafe",
"category": "North American Ale",
"description": "Rich golden hue color. Floral hop with sweet malt aroma. Medium mouth feel with malt sweetness, hop quenching flavor and well-balanced bitterness.",
"ibu": 0,
"name": "Amendment Pale Ale",
"srm": 0,
"style": "American-Style Pale Ale",
"type": "beer",
"upc": 0,
"updated": "2010-07-22 20:00:20"
}
],
"info": [
{
"caller": "http_response:160",
"code": 100,
"key": "total_rows",
"message": "4"
},
{
"caller": "http_response:162",
"code": 101,
"key": "total_elapsed_time",
"message": "116.948897ms"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment