Syntax trouble extracting elevation from Geojson

Asked Sep 15, 2022·1 reply·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi all,
I am working with a geojson file, and trying to extract a nested object to include as a displayed output of a command syntax. This object is a more uncommon, optional 3rd parameter (point type geometries usually only specify two values for coordinates). This third value is for elevation. I am having trouble forming a command syntax that will extract that particular object- perhaps because "coordinates" is a subset of the "geometry" property? I dunno, and sorry, pretty new at this.

In short, and if it's possible, I need the last part of the syntax command that will extract that object and display it as part of an embedded url fetch and listing command in Nightbot. I just don't know how to format the proper command for it to see that nested property under "coordinates", which is nested under, and as a subtree of "geometry". Do I put .geometry.coordinates, or .geometry/coordinates- or in short, how do you get the command to go past the "geometry" field and into its subset of "coordinates"??

The answer might be simple, and sorry for the newbie question.
Thanks for any help.

1 reply

Hey @Cosmic Shrimp!

Yes, you use . (dots) to access JSON keys' content, unless they're anything else than a string, then you use ['key']. See the MDN documentation.