Loading ...
Sorry, an error occurred while loading the content.

1538questions about json and pattern matching

Expand Messages
  • Nic Volanschi
    Jun 16, 2010

      I would like to submit a couple of questions to the members of this
      group, as JSON tools designers and/or users:

      1. Are you aware of any JSON codec library that implements a form of
      pattern matching like this:

      var persons = json_parse(client_message);
      var subset = selectMatching(persons,

      where subset would end up as an array filtering the persons array and
      extracting the corresponding fields, e.g.
      [{f: "John", l:"Smith", b:1991},
      {f: "Matt", l:"Johnson", b:1978}]

      Or even simpler forms of matching, for one element at a time:

      var count = {de: 0, von: 0, van: 0};
      for(p in persons) {
      res = match(p, "{name:{firstname:/^(de|von|van)/}}"); // note the embedded regex
      if(res) count[p[0]]++; // increments count.de or count.von or count.van

      2. Would you find it useful to have such a matching support as a
      complementary library, aside a json codec?

      I'm asking these questions because I wrote a generic matching library
      for JavaScript and Java (http://myPatterns.free.fr/) and I wonder if
      this could help people using JSON, such as those writing Ajax
      applications, for instance.

      Thanks for any help/comments,
    • Show all 3 messages in this topic