Skip to content

Instantly share code, notes, and snippets.

@jimmynotjim
Last active December 15, 2015 03:18
Show Gist options
  • Save jimmynotjim/5192942 to your computer and use it in GitHub Desktop.
Save jimmynotjim/5192942 to your computer and use it in GitHub Desktop.
json question
In json, is there a way to check a value against an array and find the object it belongs to?
So if I have a known value of 'apex', check it against the 'value' keys and get back Array[1]
[
{
"id":0,
"value":"aperture",
"tokens":[
"aperture",
"open counter"
],
"aka":[
"open counter"
]
},
{
"id":1,
"value":"apex",
"tokens":[
"apex",
"top"
],
"aka":[
"top"
]
},
{
"id":2,
"value":"arm",
"tokens":[
"arm",
"crossbar",
"cross stroke"
],
"aka":[
"crossbar",
"cross stroke"
]
},
{
"id":3,
"value":"ascender",
"tokens":[
"ascender",
"extender"
],
"aka":[
"extender"
]
},
{
"id":4,
"value":"axis",
"tokens":[
"axis",
"stress",
"angle of stress"
],
"aka":[
"stress",
"angle of stress"
]
},
{
"id":5,
"value":"baseline",
"tokens":[
"baseline"
],
"aka":""
},
{
"id":6,
"value":"bowl",
"tokens":[
"bowl"
],
"aka":""
},
{
"id":7,
"value":"bracket",
"tokens":[
"bracket",
"bracketed serif",
"fillet"
],
"aka":[
"bracketed serif",
"fillet"
]
},
{
"id":8,
"value":"cap line",
"tokens":[
"cap line"
],
"aka":""
},
{
"id":9,
"value":"counter",
"tokens":[
"counter",
"aperture",
"inner space",
"enclosed space"
],
"aka":[
"aperture",
"inner space",
"enclosed space"
]
},
{
"id":10,
"value":"crossbar",
"tokens":[
"crossbar",
"bar",
"arm",
"cross stroke"
],
"aka":[
"bar",
"arm",
"cross stroke"
]
},
{
"id":11,
"value":"crotch",
"tokens":[
"crotch"
],
"aka":""
},
{
"id":12,
"value":"descender",
"tokens":[
"descender",
"extender",
"tail",
"loop"
],
"aka":[
"extender",
"tail",
"loop"
]
},
{
"id":13,
"value":"diacritic",
"tokens":[
"diacritic",
"accents",
"accent marks"
],
"aka":[
"accents",
"accent marks"
]
},
{
"id":14,
"value":"diagonal stroke",
"tokens":[
"diagonal stroke"
],
"aka":""
},
{
"id":15,
"value":"discretionary ligature",
"tokens":[
"discretionary ligature"
],
"aka":""
},
{
"id":16,
"value":"ear",
"tokens":[
"ear"
],
"aka":""
},
{
"id":17,
"value":"extender",
"tokens":[
"extender"
],
"aka":""
},
{
"id":18,
"value":"eye",
"tokens":[
"eye",
"counter"
],
"aka":[
"counter"
]
},
{
"id":19,
"value":"finial",
"tokens":[
"finial",
"terminal"
],
"aka":[
"terminal"
]
},
{
"id":20,
"value":"hairline",
"tokens":[
"hairline",
"hair stroke"
],
"aka":[
"hair stroke"
]
},
{
"id":21,
"value":"leg",
"tokens":[
"leg",
"Tail"
],
"aka":[
"Tail"
]
},
{
"id":22,
"value":"ligature",
"tokens":[
"ligature"
],
"aka":""
},
{
"id":23,
"value":"open counter",
"tokens":[
"open counter",
"aperture"
],
"aka":[
"aperture"
]
},
{
"id":24,
"value":"overshoot",
"tokens":[
"overshoot"
],
"aka":""
},
{
"id":25,
"value":"shoulder",
"tokens":[
"shoulder",
"arch"
],
"aka":[
"arch"
]
},
{
"id":26,
"value":"spine",
"tokens":[
"spine"
],
"aka":""
},
{
"id":27,
"value":"spur",
"tokens":[
"spur",
"serif",
"barb",
"cat's ear"
],
"aka":[
"serif",
"barb",
"cat's ear"
]
},
{
"id":28,
"value":"stem",
"tokens":[
"stem",
"stroke"
],
"aka":[
"stroke"
]
},
{
"id":29,
"value":"tittle",
"tokens":[
"tittle",
"dot"
],
"aka":[
"dot"
]
},
{
"id":30,
"value":"x-height",
"tokens":[
"x-height",
"meanline"
],
"aka":[
"meanline"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment