I would like to document a path from a root object to some attribute or object in a JSON structure (like an XPath expression). I don’t want to dump all the JSON and then attempt to describe a path. Less important, but still a consideration is that I don’t want to give the impression that the path represents the entire JSON structure.
Does anyone have any suggestions on what a sensible syntax could look like for this? As I said, a syntax like XPath’s, but only for documentation purposes, is what I have in mind.
You could just describe the path the way you’d access the element, so for example
would guide you through a large json object, containing a pets attribute, which contains a dogs attribute with a list of them, get the first element,…