Tango JSON Parser: Accessing the members

Benji Smith dlanguage at benjismith.net
Sat Aug 16 16:38:44 PDT 2008


Incidentally...

I recently wrote a JSON parser in Java, and my implementation included a 
"JsonSelector" class, for applying an XPath-like syntax to a JSON 
hierarchy and selecting nodes from the tree. Kind of like this:

   JsonNode rootJson = JsonParser.parse(text);

   Collection<JsonNode> grandchildren = JsonSelector.select(
     "/root/child/*", rootJson
   );

   JsonNode thirdChild = JsonSelector.selectSingleNodeOrNull(
     "/root/child[3]", rootJson
   );

   Collection<JsonNode> allDocNodes = JsonSelector.select(
     "/*/doc", rootJson
   );

I'd like to contribute a similar class to the Tango JSON parser, if 
others are interested, once I can figure out how to implement a simple 
visitor pattern over the tango json objects.

--benji


More information about the Digitalmars-d-learn mailing list