0

I have a sample JSON document that has data similar to this: {"lake-piers": {"Ozark Mountain": [" fish bass", " fish catfish", " fish bluegill", " fish sunfish"],"Small Mountain": [" fish catfish", " fish bluegill", " fish sunfish"]}}

What I am looking to do is extract the keys (Ozark Mountain and Small Mountain) and the associated lists with each of them. What is throwing me a bit is the lake-piers. For two reasons. 1) the "-" which I believe i can just do a text.replace with. The second is to keep it from being the only key with JSON.parse.

fast-ta
  • 23
  • 1
  • 5
  • 1
    Ad 1) - https://stackoverflow.com/questions/24818524/accessing-json-keys-with-special-characters-in-javascript – CBroe Sep 20 '17 at 11:03
  • 1
    _“The second is to keep it from being the only key with JSON.parse”_ - that makes no sense. It **is** the only key on the top-most level. – CBroe Sep 20 '17 at 11:04
  • Ultimately what I have is this JSON being returned from a nodeJS app. I intend to display just the list of piers and their associated fish. – fast-ta Sep 20 '17 at 11:12
  • So, access the object on the first level using its key, and then loop over it ... – CBroe Sep 20 '17 at 11:15
  • Cool thanks. I think i was having issues with that key notation to your first comment. Fixed it right up. Appreciate the help! – fast-ta Sep 20 '17 at 11:20

0 Answers0